From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62A1C26FA52 for ; Tue, 1 Jul 2025 13:56:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378197; cv=none; b=k06Cm1hSblVCeJMr0+g/gz5s81SOBtiYiw5/QVnqZCkGeCeeySBJICEOd8bTzHIG1RM5jIGjdU/r6ijYKmCRUWPETGw1X9oqKr1+H12zYESdJwB7IbbxjB0PZdzHmVd3iE9hpZ6m6gfizp+OjOD72ulRMu6qiAeHB0C7Ld3kD74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378197; c=relaxed/simple; bh=njI8MgUtYO6adxTImBLYIQZAiw8t/8iuCI2/kYFqDmE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IF8lUprMxZ8/7AWdc9I7tLq2GOoY+vMnizRzpAozKsX53yXLtzNIQRUl8rWzUMLsRw8uBCgudCLIiQ4VEK5QqmX2SovVSRm5tbW2rOALqo8060uRzp7Xd95rkqlIpdq9PKPoVjNvCNwKxiDHV4+lS058dS8BSSh3jkqO3qD2SAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 7682A2379; Tue, 1 Jul 2025 06:56:19 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB6563F58B; Tue, 1 Jul 2025 06:56:33 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Oleg Nesterov , Kees Cook , Akihiko Odaki Subject: [PATCH 01/23] regset: Fix kerneldoc for struct regset_get() in user_regset Date: Tue, 1 Jul 2025 14:55:54 +0100 Message-Id: <20250701135616.29630-2-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit 7717cb9bdd04 ("regset: new method and helpers for it") added a new interface ->regset_get() for struct user_regset, and commit 1e6986c9db21 ("regset: kill ->get()") got rid of the old interface. The kerneldoc comment block was never updated to take account of this change, though. Update it. No functional change. Signed-off-by: Dave Martin Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Reviewed-by: Akihiko Odaki --- No Fixes tag, since kerneldoc is rather best-effort and the kernel works either way. Kernels with users of the old ->get() method wouldn't build any more, anyway. I can add a tag if someone wants it. I've made no effort to track down all kerneldoc discrepancies introduced by the same changeset, but I need to update this particular block for another patch. --- include/linux/regset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/regset.h b/include/linux/regset.h index 9061266dd8de..02417e934845 100644 --- a/include/linux/regset.h +++ b/include/linux/regset.h @@ -151,7 +151,7 @@ typedef int user_regset_writeback_fn(struct task_struct= *target, * @align: Required alignment, in bytes. * @bias: Bias from natural indexing. * @core_note_type: ELF note @n_type value used in core dumps. - * @get: Function to fetch values. + * @regset_get: Function to fetch values. * @set: Function to store values. * @active: Function to report if regset is active, or %NULL. * @writeback: Function to write data back to user memory, or %NULL. --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0AD727381F for ; Tue, 1 Jul 2025 13:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378198; cv=none; b=dGlGHZeL8Qw4+OpxjllXo/f12KA63VfkC4aFQ3WAQQBHnhhOiAaI2MhXGd2SyMRsbx2bxNijYLj75FY6WStX450jVdIOX2ESAVBdi2XzNnMPk5X+3OnA9j2mPsI9g4lcTRkPENoQ/PZeOXKh1XiJxH0ojs6wt+MSoJVF7flTvSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378198; c=relaxed/simple; bh=wQClYdyWZ7+lUrdBydq9nKTRqMs+zDy48A/ppFPNDFE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ewNCTakJSTDBhwT6WF416l852sNjjDUPMEo1NqfwxqkNyQijU7HGzk4p1L4WmwU1ropwK4zkXOYXxMlj+fQ/k5wRxAAx5Y30QyjFr3hw/IDXcPAOQkyRL6oZ17i+nDEjHrsJ2KZR5HAMMs0djLRgtvdELlDvN6sAoDVc8SyG5fA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 A18672381; Tue, 1 Jul 2025 06:56:20 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 22E573F58B; Tue, 1 Jul 2025 06:56:34 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Oleg Nesterov , Kees Cook , Akihiko Odaki Subject: [PATCH 02/23] regset: Add explicit core note name in struct user_regset Date: Tue, 1 Jul 2025 14:55:55 +0100 Message-Id: <20250701135616.29630-3-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is currently hard-coded logic spread around the tree for determining the note name for regset notes emitted in coredumps. Now that the names are declared explicitly in , this can be simplified. In preparation for getting rid of the special-case logic, add an explicit core_note_name field in struct user_regset for specifying the note name explicitly. To help avoid mistakes, a convenience macro USER_REGSET_NOTE_TYPE() is provided to set .core_note_type and .core_note_name based on the note type. When dumping core, use the new field to set the note name, if the regset specifies it. Signed-off-by: Dave Martin Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Acked-by: Alexander Gordeev # s390 Reviewed-by: Akihiko Odaki --- fs/binfmt_elf.c | 8 ++++++-- include/linux/regset.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index a43363d593e5..f1069103ca24 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1727,6 +1727,7 @@ static int fill_thread_core_info(struct elf_thread_co= re_info *t, for (view_iter =3D 1; view_iter < view->n; ++view_iter) { const struct user_regset *regset =3D &view->regsets[view_iter]; int note_type =3D regset->core_note_type; + const char *note_name =3D regset->core_note_name; bool is_fpreg =3D note_type =3D=3D NT_PRFPREG; void *data; int ret; @@ -1747,8 +1748,11 @@ static int fill_thread_core_info(struct elf_thread_c= ore_info *t, if (is_fpreg) SET_PR_FPVALID(&t->prstatus); =20 - fill_note(&t->notes[note_iter], is_fpreg ? NN_PRFPREG : "LINUX", - note_type, ret, data); + if (!note_name) + note_name =3D is_fpreg ? NN_PRFPREG : "LINUX"; + + fill_note(&t->notes[note_iter], note_name, note_type, + ret, data); =20 info->size +=3D notesize(&t->notes[note_iter]); note_iter++; diff --git a/include/linux/regset.h b/include/linux/regset.h index 02417e934845..ad1ca6fe04f4 100644 --- a/include/linux/regset.h +++ b/include/linux/regset.h @@ -151,6 +151,7 @@ typedef int user_regset_writeback_fn(struct task_struct= *target, * @align: Required alignment, in bytes. * @bias: Bias from natural indexing. * @core_note_type: ELF note @n_type value used in core dumps. + * @core_note_name: ELF note name to qualify the note type. * @regset_get: Function to fetch values. * @set: Function to store values. * @active: Function to report if regset is active, or %NULL. @@ -190,6 +191,10 @@ typedef int user_regset_writeback_fn(struct task_struc= t *target, * * If nonzero, @core_note_type gives the n_type field (NT_* value) * of the core file note in which this regset's data appears. + * @core_note_name specifies the note name. The preferred way to + * specify these two fields is to use the @USER_REGSET_NOTE_TYPE() + * macro. + * * NT_PRSTATUS is a special case in that the regset data starts at * offsetof(struct elf_prstatus, pr_reg) into the note data; that is * part of the per-machine ELF formats userland knows about. In @@ -207,8 +212,13 @@ struct user_regset { unsigned int align; unsigned int bias; unsigned int core_note_type; + const char *core_note_name; }; =20 +#define USER_REGSET_NOTE_TYPE(type) \ + .core_note_type =3D (NT_ ## type), \ + .core_note_name =3D (NN_ ## type) + /** * struct user_regset_view - available regsets * @name: Identifier, e.g. UTS_MACHINE string. --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D26282777E2 for ; Tue, 1 Jul 2025 13:56:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378200; cv=none; b=S/InZOfMN9NOtlbdRw5n9FpDMu9WCJEfDjWKPQdWnnHf+3gMcVU0Qd0Cr4TnwxBGIyOWac84XMCS9LngA674C6TSiXu6OXMmgkiBl0WPVbv/zml6Nx9mqdctMC3F3uA8G8VXuj5UTVGgdfPMMYzr4qmF5ktUeK65h2FikNMW1vM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378200; c=relaxed/simple; bh=W+kCIfTCQUoCgl6X32zm/tFOFqY0TcwVE/cx63X5Eo4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EyrjIbpfL9Tq61LhgkXC3KwUF4aRDfYkvgLnsX2XDIJMhM/LIeQb4F+OKY7I2M/9br6GBKZHtyOb5KydjMl4tFsn0yryiohdxyE3CCvwl6Ttg+W52+4xkLfq14iwUTOaBPjOFFjo/3xEyuFRx7IAVPjv06A0EIgidqJ7z97fMlg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 CD0DB26A4; Tue, 1 Jul 2025 06:56:21 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4E8EF3F58B; Tue, 1 Jul 2025 06:56:36 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Oleg Nesterov , Kees Cook , Akihiko Odaki Subject: [PATCH 03/23] binfmt_elf: Dump non-arch notes with strictly matching name and type Date: Tue, 1 Jul 2025 14:55:56 +0100 Message-Id: <20250701135616.29630-4-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The note names for some arch-independent coredump notes are specified manually, albeit by referring to the NN_ #define corresponding to the NT_ #define that specifies the note type. Now that there are no exceptional cases, refactor fill_note() to pick the correct NN_ and NT_ macros implcitly for the requested note type. Signed-off-by: Dave Martin Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Reviewed-by: Akihiko Odaki --- fs/binfmt_elf.c | 27 ++++++++++++++------------- fs/binfmt_elf_fdpic.c | 17 +++++++++-------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index f1069103ca24..89063d1d9e9a 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1450,8 +1450,8 @@ static void fill_elf_note_phdr(struct elf_phdr *phdr,= int sz, loff_t offset) phdr->p_align =3D 4; } =20 -static void fill_note(struct memelfnote *note, const char *name, int type, - unsigned int sz, void *data) +static void __fill_note(struct memelfnote *note, const char *name, int typ= e, + unsigned int sz, void *data) { note->name =3D name; note->type =3D type; @@ -1459,6 +1459,9 @@ static void fill_note(struct memelfnote *note, const = char *name, int type, note->data =3D data; } =20 +#define fill_note(note, type, sz, data) \ + __fill_note(note, NN_ ## type, NT_ ## type, sz, data) + /* * fill up all the fields in prstatus from the given task struct, except * registers which need to be filled up separately. @@ -1549,14 +1552,14 @@ static void fill_auxv_note(struct memelfnote *note,= struct mm_struct *mm) do i +=3D 2; while (auxv[i - 2] !=3D AT_NULL); - fill_note(note, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv); + fill_note(note, AUXV, i * sizeof(elf_addr_t), auxv); } =20 static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csi= gdata, const kernel_siginfo_t *siginfo) { copy_siginfo_to_external(csigdata, siginfo); - fill_note(note, NN_SIGINFO, NT_SIGINFO, sizeof(*csigdata), csigdata); + fill_note(note, SIGINFO, sizeof(*csigdata), csigdata); } =20 /* @@ -1652,7 +1655,7 @@ static int fill_files_note(struct memelfnote *note, s= truct coredump_params *cprm } =20 size =3D name_curpos - (char *)data; - fill_note(note, NN_FILE, NT_FILE, size, data); + fill_note(note, FILE, size, data); return 0; } =20 @@ -1713,8 +1716,7 @@ static int fill_thread_core_info(struct elf_thread_co= re_info *t, regset_get(t->task, &view->regsets[0], sizeof(t->prstatus.pr_reg), &t->prstatus.pr_reg); =20 - fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS, - PRSTATUS_SIZE, &t->prstatus); + fill_note(&t->notes[0], PRSTATUS, PRSTATUS_SIZE, &t->prstatus); info->size +=3D notesize(&t->notes[0]); =20 do_thread_regset_writeback(t->task, &view->regsets[0]); @@ -1751,8 +1753,8 @@ static int fill_thread_core_info(struct elf_thread_co= re_info *t, if (!note_name) note_name =3D is_fpreg ? NN_PRFPREG : "LINUX"; =20 - fill_note(&t->notes[note_iter], note_name, note_type, - ret, data); + __fill_note(&t->notes[note_iter], note_name, note_type, + ret, data); =20 info->size +=3D notesize(&t->notes[note_iter]); note_iter++; @@ -1771,8 +1773,7 @@ static int fill_thread_core_info(struct elf_thread_co= re_info *t, fill_prstatus(&t->prstatus.common, p, signr); elf_core_copy_task_regs(p, &t->prstatus.pr_reg); =20 - fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS, sizeof(t->prstatus), - &(t->prstatus)); + fill_note(&t->notes[0], PRSTATUS, sizeof(t->prstatus), &t->prstatus); info->size +=3D notesize(&t->notes[0]); =20 fpu =3D kzalloc(sizeof(elf_fpregset_t), GFP_KERNEL); @@ -1782,7 +1783,7 @@ static int fill_thread_core_info(struct elf_thread_co= re_info *t, } =20 t->prstatus.pr_fpvalid =3D 1; - fill_note(&t->notes[1], NN_PRFPREG, NT_PRFPREG, sizeof(*fpu), fpu); + fill_note(&t->notes[1], PRFPREG, sizeof(*fpu), fpu); info->size +=3D notesize(&t->notes[1]); =20 return 1; @@ -1802,7 +1803,7 @@ static int fill_note_info(struct elfhdr *elf, int phd= rs, psinfo =3D kmalloc(sizeof(*psinfo), GFP_KERNEL); if (!psinfo) return 0; - fill_note(&info->psinfo, NN_PRPSINFO, NT_PRPSINFO, sizeof(*psinfo), psinf= o); + fill_note(&info->psinfo, PRPSINFO, sizeof(*psinfo), psinfo); =20 #ifdef CORE_DUMP_USE_REGSET view =3D task_user_regset_view(dump_task); diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 9133f3827f90..68b884df2011 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -1275,8 +1275,8 @@ static inline void fill_elf_note_phdr(struct elf_phdr= *phdr, int sz, loff_t offs return; } =20 -static inline void fill_note(struct memelfnote *note, const char *name, in= t type, - unsigned int sz, void *data) +static inline void __fill_note(struct memelfnote *note, const char *name, = int type, + unsigned int sz, void *data) { note->name =3D name; note->type =3D type; @@ -1285,6 +1285,9 @@ static inline void fill_note(struct memelfnote *note,= const char *name, int type return; } =20 +#define fill_note(note, type, sz, data) \ + __fill_note(note, NN_ ## type, NT_ ## type, sz, data) + /* * fill up all the fields in prstatus from the given task struct, except * registers which need to be filled up separately. @@ -1398,8 +1401,7 @@ static struct elf_thread_status *elf_dump_thread_stat= us(long signr, struct task_ regset_get(p, &view->regsets[0], sizeof(t->prstatus.pr_reg), &t->prstatus.pr_reg); =20 - fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS, sizeof(t->prstatus), - &t->prstatus); + fill_note(&t->notes[0], PRSTATUS, sizeof(t->prstatus), &t->prstatus); t->num_notes++; *sz +=3D notesize(&t->notes[0]); =20 @@ -1416,8 +1418,7 @@ static struct elf_thread_status *elf_dump_thread_stat= us(long signr, struct task_ } =20 if (t->prstatus.pr_fpvalid) { - fill_note(&t->notes[1], NN_PRFPREG, NT_PRFPREG, sizeof(t->fpu), - &t->fpu); + fill_note(&t->notes[1], PRFPREG, sizeof(t->fpu), &t->fpu); t->num_notes++; *sz +=3D notesize(&t->notes[1]); } @@ -1531,7 +1532,7 @@ static int elf_fdpic_core_dump(struct coredump_params= *cprm) */ =20 fill_psinfo(psinfo, current->group_leader, current->mm); - fill_note(&psinfo_note, NN_PRPSINFO, NT_PRPSINFO, sizeof(*psinfo), psinfo= ); + fill_note(&psinfo_note, PRPSINFO, sizeof(*psinfo), psinfo); thread_status_size +=3D notesize(&psinfo_note); =20 auxv =3D (elf_addr_t *) current->mm->saved_auxv; @@ -1539,7 +1540,7 @@ static int elf_fdpic_core_dump(struct coredump_params= *cprm) do i +=3D 2; while (auxv[i - 2] !=3D AT_NULL); - fill_note(&auxv_note, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv); + fill_note(&auxv_note, AUXV, i * sizeof(elf_addr_t), auxv); thread_status_size +=3D notesize(&auxv_note); =20 offset =3D sizeof(*elf); /* ELF header */ --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53337277808 for ; Tue, 1 Jul 2025 13:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378200; cv=none; b=Ek3cTAa/geX8vMvJ8qLHscyc38HBJpilJD6wY+Sv0LMoeiug98IXsq47BUEM87ehB7UQKTIubnp/U+5186ewZOFVLxAd9xFgmNw+F0RrKpdGwU7C+bm2v+WSEoQS3PDmsJrrSU3zY5JcrLHmrMaBf3af4rWFPfV6W4CVEH85dXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378200; c=relaxed/simple; bh=FvX9IvQ7Ier1QvcK83GKrL/en43fv09+Z2mqBydrevA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=M11QDPGYyN4o4blsyLo/eBq3l8GjViahREPsxKfPfHstP5L4y1y0u6/ann12AUfgTTDaih9RWKVIbvUNaC4d7tjfZYMOzXt0bUGEa1BQ3zU17vxs0Ymhsx7/U15HHRm7Y1p2gqldYzxPO93cKgj2+qjSliRCe7n4Q+6XgMqH/eA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 4C5C32696; Tue, 1 Jul 2025 06:56:23 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A5673F58B; Tue, 1 Jul 2025 06:56:37 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Vineet Gupta , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-snps-arc@lists.infradead.org Subject: [PATCH 04/23] ARC: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:55:57 +0100 Message-Id: <20250701135616.29630-5-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Vineet Gupta Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-snps-arc@lists.infradead.org Reviewed-by: Akihiko Odaki --- arch/arc/kernel/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c index e0c233c178b1..cad5367b7c37 100644 --- a/arch/arc/kernel/ptrace.c +++ b/arch/arc/kernel/ptrace.c @@ -284,7 +284,7 @@ enum arc_getset { =20 static const struct user_regset arc_regsets[] =3D { [REGSET_CMN] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(unsigned long), .align =3D sizeof(unsigned long), @@ -293,7 +293,7 @@ static const struct user_regset arc_regsets[] =3D { }, #ifdef CONFIG_ISA_ARCV2 [REGSET_ARCV2] =3D { - .core_note_type =3D NT_ARC_V2, + USER_REGSET_NOTE_TYPE(ARC_V2), .n =3D ELF_ARCV2REG, .size =3D sizeof(unsigned long), .align =3D sizeof(unsigned long), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C144B277C86 for ; Tue, 1 Jul 2025 13:56:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378202; cv=none; b=n4NA/uwmGQ8Ja6QE0WyT+hUn3s0eswHqSCffOQJ3WdEodYMjFuCMmRQCW/OckoJZjs5MrsxorL06+siGf0L/dy0wK/Gbez3hGIkrSqBeW9g38wkW03o9htLRFzKwpESLaW6lvDsLgs0FBb97ewYJXLgV1Ax9HHyUFF4bpwOnOGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378202; c=relaxed/simple; bh=ieyE9ETnb3U8FCyTH8Xt6FmpLK2fj7uOWDi1mDrtPbY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k49ShSz8BTcxYO3BXagRvvXIrWJexe8UlAsCTMxxAr1A3yaMEUEpFgDsKl3wPrO8UWfAxQzBG4xqvxPYqzVJs6drTf+wJBSaeNL5tBWBSWtf60Yb925CYROCQr3gPZk8C6MMtutYl4KKfVVP590oWJ1IZ3mWqezzijXoupbHHJA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 C009626BA; Tue, 1 Jul 2025 06:56:24 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ED95F3F58B; Tue, 1 Jul 2025 06:56:38 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Russell King , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-arm-kernel@lists.infradead.org Subject: [PATCH 05/23] ARM: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:55:58 +0100 Message-Id: <20250701135616.29630-6-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Russell King Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Akihiko Odaki --- arch/arm/kernel/ptrace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index c421a899fc84..7951b2c06fec 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -677,7 +677,7 @@ enum arm_regset { =20 static const struct user_regset arm_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -689,7 +689,7 @@ static const struct user_regset arm_regsets[] =3D { * For the FPA regs in fpstate, the real fields are a mixture * of sizes, so pretend that the registers are word-sized: */ - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct user_fp) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -702,7 +702,7 @@ static const struct user_regset arm_regsets[] =3D { * Pretend that the VFP regs are word-sized, since the FPSCR is * a single word dangling at the end of struct user_vfp: */ - .core_note_type =3D NT_ARM_VFP, + USER_REGSET_NOTE_TYPE(ARM_VFP), .n =3D ARM_VFPREGS_SIZE / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EBE9277CB2 for ; Tue, 1 Jul 2025 13:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378203; cv=none; b=ON3UhUONvtQruu6+jqjxjJr68tezcfg2EB7EJHipinTRYlquh4HR1DCOWIkLeDliv3y6cyDmJRjxeiKpBD7kYKb+7htFiGOr1GRRmeKqn2Y5vfd3xEbCP6kv5GQDeSWra3gT8KpX3MrSmAhNuoWxJJgrwH/1sw1SLfKk28HVsqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378203; c=relaxed/simple; bh=fGBQy5H9Eg8UKPtdjbbWliurPYD6999EXV9MDysGqv0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aDWVziip1PpBAUbDfSenU+siWDlFcbE4S1fPtM+VBFr7Ifz4NE2A+NPaY83fR0A0A2y0kGmoAzn0OhSrTKAY0Ad8OmHy3n7QXhFtFGM95aMKAB1dBV7wKdyE9du5MzBgZ6vMfOV9O9IKqVBqlnra++/MMzq74PnxCbs5DT/rbtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 88F872D8E; Tue, 1 Jul 2025 06:56:26 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D7FA3F58B; Tue, 1 Jul 2025 06:56:40 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-arm-kernel@lists.infradead.org Subject: [PATCH 06/23] arm64: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:55:59 +0100 Message-Id: <20250701135616.29630-7-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. This does not affect the correctness of switch(note_type) and similar code, since note type values known to Linux for coredump purposes were already required to be unique. Signed-off-by: Dave Martin Cc: Catalin Marinas Cc: Will Deacon Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Akihiko Odaki --- arch/arm64/kernel/ptrace.c | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index ee94b72bf8fb..4b001121c72d 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -1586,7 +1586,7 @@ enum aarch64_regset { =20 static const struct user_regset aarch64_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D sizeof(struct user_pt_regs) / sizeof(u64), .size =3D sizeof(u64), .align =3D sizeof(u64), @@ -1594,7 +1594,7 @@ static const struct user_regset aarch64_regsets[] =3D= { .set =3D gpr_set }, [REGSET_FPR] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct user_fpsimd_state) / sizeof(u32), /* * We pretend we have 32-bit registers because the fpsr and @@ -1607,7 +1607,7 @@ static const struct user_regset aarch64_regsets[] =3D= { .set =3D fpr_set }, [REGSET_TLS] =3D { - .core_note_type =3D NT_ARM_TLS, + USER_REGSET_NOTE_TYPE(ARM_TLS), .n =3D 2, .size =3D sizeof(void *), .align =3D sizeof(void *), @@ -1616,7 +1616,7 @@ static const struct user_regset aarch64_regsets[] =3D= { }, #ifdef CONFIG_HAVE_HW_BREAKPOINT [REGSET_HW_BREAK] =3D { - .core_note_type =3D NT_ARM_HW_BREAK, + USER_REGSET_NOTE_TYPE(ARM_HW_BREAK), .n =3D sizeof(struct user_hwdebug_state) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -1624,7 +1624,7 @@ static const struct user_regset aarch64_regsets[] =3D= { .set =3D hw_break_set, }, [REGSET_HW_WATCH] =3D { - .core_note_type =3D NT_ARM_HW_WATCH, + USER_REGSET_NOTE_TYPE(ARM_HW_WATCH), .n =3D sizeof(struct user_hwdebug_state) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -1633,7 +1633,7 @@ static const struct user_regset aarch64_regsets[] =3D= { }, #endif [REGSET_SYSTEM_CALL] =3D { - .core_note_type =3D NT_ARM_SYSTEM_CALL, + USER_REGSET_NOTE_TYPE(ARM_SYSTEM_CALL), .n =3D 1, .size =3D sizeof(int), .align =3D sizeof(int), @@ -1641,7 +1641,7 @@ static const struct user_regset aarch64_regsets[] =3D= { .set =3D system_call_set, }, [REGSET_FPMR] =3D { - .core_note_type =3D NT_ARM_FPMR, + USER_REGSET_NOTE_TYPE(ARM_FPMR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), @@ -1650,7 +1650,7 @@ static const struct user_regset aarch64_regsets[] =3D= { }, #ifdef CONFIG_ARM64_SVE [REGSET_SVE] =3D { /* Scalable Vector Extension */ - .core_note_type =3D NT_ARM_SVE, + USER_REGSET_NOTE_TYPE(ARM_SVE), .n =3D DIV_ROUND_UP(SVE_PT_SIZE(ARCH_SVE_VQ_MAX, SVE_PT_REGS_SVE), SVE_VQ_BYTES), @@ -1662,7 +1662,7 @@ static const struct user_regset aarch64_regsets[] =3D= { #endif #ifdef CONFIG_ARM64_SME [REGSET_SSVE] =3D { /* Streaming mode SVE */ - .core_note_type =3D NT_ARM_SSVE, + USER_REGSET_NOTE_TYPE(ARM_SSVE), .n =3D DIV_ROUND_UP(SVE_PT_SIZE(SME_VQ_MAX, SVE_PT_REGS_SVE), SVE_VQ_BYTES), .size =3D SVE_VQ_BYTES, @@ -1671,7 +1671,7 @@ static const struct user_regset aarch64_regsets[] =3D= { .set =3D ssve_set, }, [REGSET_ZA] =3D { /* SME ZA */ - .core_note_type =3D NT_ARM_ZA, + USER_REGSET_NOTE_TYPE(ARM_ZA), /* * ZA is a single register but it's variably sized and * the ptrace core requires that the size of any data @@ -1687,7 +1687,7 @@ static const struct user_regset aarch64_regsets[] =3D= { .set =3D za_set, }, [REGSET_ZT] =3D { /* SME ZT */ - .core_note_type =3D NT_ARM_ZT, + USER_REGSET_NOTE_TYPE(ARM_ZT), .n =3D 1, .size =3D ZT_SIG_REG_BYTES, .align =3D sizeof(u64), @@ -1697,7 +1697,7 @@ static const struct user_regset aarch64_regsets[] =3D= { #endif #ifdef CONFIG_ARM64_PTR_AUTH [REGSET_PAC_MASK] =3D { - .core_note_type =3D NT_ARM_PAC_MASK, + USER_REGSET_NOTE_TYPE(ARM_PAC_MASK), .n =3D sizeof(struct user_pac_mask) / sizeof(u64), .size =3D sizeof(u64), .align =3D sizeof(u64), @@ -1705,7 +1705,7 @@ static const struct user_regset aarch64_regsets[] =3D= { /* this cannot be set dynamically */ }, [REGSET_PAC_ENABLED_KEYS] =3D { - .core_note_type =3D NT_ARM_PAC_ENABLED_KEYS, + USER_REGSET_NOTE_TYPE(ARM_PAC_ENABLED_KEYS), .n =3D 1, .size =3D sizeof(long), .align =3D sizeof(long), @@ -1714,7 +1714,7 @@ static const struct user_regset aarch64_regsets[] =3D= { }, #ifdef CONFIG_CHECKPOINT_RESTORE [REGSET_PACA_KEYS] =3D { - .core_note_type =3D NT_ARM_PACA_KEYS, + USER_REGSET_NOTE_TYPE(ARM_PACA_KEYS), .n =3D sizeof(struct user_pac_address_keys) / sizeof(__uint128_t), .size =3D sizeof(__uint128_t), .align =3D sizeof(__uint128_t), @@ -1722,7 +1722,7 @@ static const struct user_regset aarch64_regsets[] =3D= { .set =3D pac_address_keys_set, }, [REGSET_PACG_KEYS] =3D { - .core_note_type =3D NT_ARM_PACG_KEYS, + USER_REGSET_NOTE_TYPE(ARM_PACG_KEYS), .n =3D sizeof(struct user_pac_generic_keys) / sizeof(__uint128_t), .size =3D sizeof(__uint128_t), .align =3D sizeof(__uint128_t), @@ -1733,7 +1733,7 @@ static const struct user_regset aarch64_regsets[] =3D= { #endif #ifdef CONFIG_ARM64_TAGGED_ADDR_ABI [REGSET_TAGGED_ADDR_CTRL] =3D { - .core_note_type =3D NT_ARM_TAGGED_ADDR_CTRL, + USER_REGSET_NOTE_TYPE(ARM_TAGGED_ADDR_CTRL), .n =3D 1, .size =3D sizeof(long), .align =3D sizeof(long), @@ -1743,7 +1743,7 @@ static const struct user_regset aarch64_regsets[] =3D= { #endif #ifdef CONFIG_ARM64_POE [REGSET_POE] =3D { - .core_note_type =3D NT_ARM_POE, + USER_REGSET_NOTE_TYPE(ARM_POE), .n =3D 1, .size =3D sizeof(long), .align =3D sizeof(long), @@ -1753,7 +1753,7 @@ static const struct user_regset aarch64_regsets[] =3D= { #endif #ifdef CONFIG_ARM64_GCS [REGSET_GCS] =3D { - .core_note_type =3D NT_ARM_GCS, + USER_REGSET_NOTE_TYPE(ARM_GCS), .n =3D sizeof(struct user_gcs) / sizeof(u64), .size =3D sizeof(u64), .align =3D sizeof(u64), @@ -1943,7 +1943,7 @@ static int compat_tls_set(struct task_struct *target, =20 static const struct user_regset aarch32_regsets[] =3D { [REGSET_COMPAT_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D COMPAT_ELF_NGREG, .size =3D sizeof(compat_elf_greg_t), .align =3D sizeof(compat_elf_greg_t), @@ -1951,7 +1951,7 @@ static const struct user_regset aarch32_regsets[] =3D= { .set =3D compat_gpr_set }, [REGSET_COMPAT_VFP] =3D { - .core_note_type =3D NT_ARM_VFP, + USER_REGSET_NOTE_TYPE(ARM_VFP), .n =3D VFP_STATE_SIZE / sizeof(compat_ulong_t), .size =3D sizeof(compat_ulong_t), .align =3D sizeof(compat_ulong_t), @@ -1968,7 +1968,7 @@ static const struct user_regset_view user_aarch32_vie= w =3D { =20 static const struct user_regset aarch32_ptrace_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D COMPAT_ELF_NGREG, .size =3D sizeof(compat_elf_greg_t), .align =3D sizeof(compat_elf_greg_t), @@ -1976,7 +1976,7 @@ static const struct user_regset aarch32_ptrace_regset= s[] =3D { .set =3D compat_gpr_set }, [REGSET_FPR] =3D { - .core_note_type =3D NT_ARM_VFP, + USER_REGSET_NOTE_TYPE(ARM_VFP), .n =3D VFP_STATE_SIZE / sizeof(compat_ulong_t), .size =3D sizeof(compat_ulong_t), .align =3D sizeof(compat_ulong_t), @@ -1984,7 +1984,7 @@ static const struct user_regset aarch32_ptrace_regset= s[] =3D { .set =3D compat_vfp_set }, [REGSET_TLS] =3D { - .core_note_type =3D NT_ARM_TLS, + USER_REGSET_NOTE_TYPE(ARM_TLS), .n =3D 1, .size =3D sizeof(compat_ulong_t), .align =3D sizeof(compat_ulong_t), @@ -1993,7 +1993,7 @@ static const struct user_regset aarch32_ptrace_regset= s[] =3D { }, #ifdef CONFIG_HAVE_HW_BREAKPOINT [REGSET_HW_BREAK] =3D { - .core_note_type =3D NT_ARM_HW_BREAK, + USER_REGSET_NOTE_TYPE(ARM_HW_BREAK), .n =3D sizeof(struct user_hwdebug_state) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -2001,7 +2001,7 @@ static const struct user_regset aarch32_ptrace_regset= s[] =3D { .set =3D hw_break_set, }, [REGSET_HW_WATCH] =3D { - .core_note_type =3D NT_ARM_HW_WATCH, + USER_REGSET_NOTE_TYPE(ARM_HW_WATCH), .n =3D sizeof(struct user_hwdebug_state) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -2010,7 +2010,7 @@ static const struct user_regset aarch32_ptrace_regset= s[] =3D { }, #endif [REGSET_SYSTEM_CALL] =3D { - .core_note_type =3D NT_ARM_SYSTEM_CALL, + USER_REGSET_NOTE_TYPE(ARM_SYSTEM_CALL), .n =3D 1, .size =3D sizeof(int), .align =3D sizeof(int), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05FF227817D; Tue, 1 Jul 2025 13:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378205; cv=none; b=mRuwewYzQ/bpve095w5im27Hm6URVS0WKfnfRA1Pfp/fsTQXp5BmmVH1Rf0GBM/10xV/8YGlD3dj6HEEay/ZapnPmXAMSfmMDBWgNknVPdy2OPK8vjoSmwOQ7reMQTMztaFBXjRT88nunNVtFtqEnrZaW6loYa2/zsph/rH0ejo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378205; c=relaxed/simple; bh=3bIgU0XyHqo1DF6Gu7rQQsMcLwH873FqmpmTDaoYukM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Pvl8h7VZ7n2JTifG7JpAUGa5ufK5sGQ4kEUo/ptyzjDe2DH84Dy6g+Zh55hxwHHJkIW1Ck2NUN6JdSZkKcCZjtXZq3WBGzAc6W50UIgp0Vb9miig+TZul642TroolG13HxUIbpcQUiPVy2idZm3x+AbjZm1+F8d8pRuUh/eAWyg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 060BA237B; Tue, 1 Jul 2025 06:56:28 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 33EEF3F58B; Tue, 1 Jul 2025 06:56:42 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Guo Ren , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-csky@vger.kernel.org Subject: [PATCH 07/23] csky: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:00 +0100 Message-Id: <20250701135616.29630-8-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Guo Ren Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-csky@vger.kernel.org Reviewed-by: Akihiko Odaki --- arch/csky/kernel/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/csky/kernel/ptrace.c b/arch/csky/kernel/ptrace.c index 0f7e7b653c72..6bb685a2646b 100644 --- a/arch/csky/kernel/ptrace.c +++ b/arch/csky/kernel/ptrace.c @@ -166,7 +166,7 @@ static int fpr_set(struct task_struct *target, =20 static const struct user_regset csky_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D sizeof(struct pt_regs) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -174,7 +174,7 @@ static const struct user_regset csky_regsets[] =3D { .set =3D gpr_set, }, [REGSET_FPR] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct user_fp) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A3EA27815E; Tue, 1 Jul 2025 13:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378206; cv=none; b=CsqPxeb2URXxDltlwzmufBxa4u+3wgwKu4CzfjwlI0AwAh7xA9unXJPtrmmj+zCTS4oLebcStM7CvMf5N5fxNSkbz2ySTaUXLrDnTWrHBjtFn0FgTt5op2Q2MOe1kE6o4FDnz50Bb59EPYZ0qETq6vw0VvdpEYM4NmIqun2X5Ng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378206; c=relaxed/simple; bh=/shdMZwCV+KkBBiLg52KW5JwqpXSxghASPezdRQnh/k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t/hu4/l54Mly2RIv52VeCEQhJDJee/UnjqM1CK5XQz/WrhOjquDkRd5jIiGGuLsedkCnAnFCUJrKDmu90qh+0asGr27va7QruvFkv4PljOxV7BygAuJyecNXLLHqjT4cy4F961Z6SkoZOIwKaNePuYewZZzkkiEbKkpW8PP6p8A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 799D726BC; Tue, 1 Jul 2025 06:56:29 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A78E93F58B; Tue, 1 Jul 2025 06:56:43 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Brian Cain , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-hexagon@vger.kernel.org Subject: [PATCH 08/23] hexagon: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:01 +0100 Message-Id: <20250701135616.29630-9-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Brian Cain Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-hexagon@vger.kernel.org Reviewed-by: Akihiko Odaki --- arch/hexagon/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c index 905b06790ab7..2093eee143e1 100644 --- a/arch/hexagon/kernel/ptrace.c +++ b/arch/hexagon/kernel/ptrace.c @@ -137,7 +137,7 @@ enum hexagon_regset { =20 static const struct user_regset hexagon_regsets[] =3D { [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(unsigned long), .align =3D sizeof(unsigned long), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1079F27934E for ; Tue, 1 Jul 2025 13:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378208; cv=none; b=UIDlllaLkCLM25hx6+opSuOKFEUmWYfsXzjFc7M3LodaBGXjLCrtnundd2JlPYVSGYMBxH8IzFJIesZk8XjcGwehB9DEq2LVZNh1ZOfGnvnDbcrzqaeXqPAytcAsJn5fDFVX74/cnTzx3PIH9x9rgMsW++stPwut7Eb0SkpCOjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378208; c=relaxed/simple; bh=ytq/9fww8AXTLVMYocd4pAESXZABk52E6oaAbFgnIrc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gKUbVMWqJKchXJQpAv91vqy+H72wAI7AAXfxO07w+I5hi7VjDSncgNH8OBFagNne4N7J27RK4IdpdoTIdyKLR1Ny95ov98fNziKQa+i1JuNI7m6WCayEnO8+SA9GiIHyD9fXEDCS62M44q4YlrL6I/gThMpgNINQbrlf2GUnbhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 1D1292E8E; Tue, 1 Jul 2025 06:56:31 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2716D3F58B; Tue, 1 Jul 2025 06:56:45 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Huacai Chen , WANG Xuerui , Oleg Nesterov , Kees Cook , Akihiko Odaki , loongarch@lists.linux.dev Subject: [PATCH 09/23] LoongArch: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:02 +0100 Message-Id: <20250701135616.29630-10-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Huacai Chen Cc: WANG Xuerui Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: loongarch@lists.linux.dev Reviewed-by: Akihiko Odaki --- arch/loongarch/kernel/ptrace.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/loongarch/kernel/ptrace.c b/arch/loongarch/kernel/ptrace.c index 5e2402cfcab0..8edd0954e55a 100644 --- a/arch/loongarch/kernel/ptrace.c +++ b/arch/loongarch/kernel/ptrace.c @@ -864,7 +864,7 @@ enum loongarch_regset { =20 static const struct user_regset loongarch64_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(elf_greg_t), .align =3D sizeof(elf_greg_t), @@ -872,7 +872,7 @@ static const struct user_regset loongarch64_regsets[] = =3D { .set =3D gpr_set, }, [REGSET_FPR] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(elf_fpreg_t), .align =3D sizeof(elf_fpreg_t), @@ -880,7 +880,7 @@ static const struct user_regset loongarch64_regsets[] = =3D { .set =3D fpr_set, }, [REGSET_CPUCFG] =3D { - .core_note_type =3D NT_LOONGARCH_CPUCFG, + USER_REGSET_NOTE_TYPE(LOONGARCH_CPUCFG), .n =3D 64, .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -889,7 +889,7 @@ static const struct user_regset loongarch64_regsets[] = =3D { }, #ifdef CONFIG_CPU_HAS_LSX [REGSET_LSX] =3D { - .core_note_type =3D NT_LOONGARCH_LSX, + USER_REGSET_NOTE_TYPE(LOONGARCH_LSX), .n =3D NUM_FPU_REGS, .size =3D 16, .align =3D 16, @@ -899,7 +899,7 @@ static const struct user_regset loongarch64_regsets[] = =3D { #endif #ifdef CONFIG_CPU_HAS_LASX [REGSET_LASX] =3D { - .core_note_type =3D NT_LOONGARCH_LASX, + USER_REGSET_NOTE_TYPE(LOONGARCH_LASX), .n =3D NUM_FPU_REGS, .size =3D 32, .align =3D 32, @@ -909,7 +909,7 @@ static const struct user_regset loongarch64_regsets[] = =3D { #endif #ifdef CONFIG_CPU_HAS_LBT [REGSET_LBT] =3D { - .core_note_type =3D NT_LOONGARCH_LBT, + USER_REGSET_NOTE_TYPE(LOONGARCH_LBT), .n =3D 5, .size =3D sizeof(u64), .align =3D sizeof(u64), @@ -919,7 +919,7 @@ static const struct user_regset loongarch64_regsets[] = =3D { #endif #ifdef CONFIG_HAVE_HW_BREAKPOINT [REGSET_HW_BREAK] =3D { - .core_note_type =3D NT_LOONGARCH_HW_BREAK, + USER_REGSET_NOTE_TYPE(LOONGARCH_HW_BREAK), .n =3D sizeof(struct user_watch_state_v2) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -927,7 +927,7 @@ static const struct user_regset loongarch64_regsets[] = =3D { .set =3D hw_break_set, }, [REGSET_HW_WATCH] =3D { - .core_note_type =3D NT_LOONGARCH_HW_WATCH, + USER_REGSET_NOTE_TYPE(LOONGARCH_HW_WATCH), .n =3D sizeof(struct user_watch_state_v2) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71A24278741 for ; Tue, 1 Jul 2025 13:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378209; cv=none; b=QCTHJxQ2W5GHH/+wx9Hci4XYHgfqot8cI7CMYps7oxMvWxoQmyyTCl3JglrIUXt3+3aSu3y+G6PsMb9e5lwPiMDBExvBuAiLNtD7SCAq9L4t3QgrnDlAkGUaeE4Um+52Y7YkDnj2ogfgA1E9Zy96d+3VZiP+Ei+zWFT382Kqyys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378209; c=relaxed/simple; bh=/x8vGB0nmkspDjfupjudUNeIZO1JlkzKZlMCbeEmwRs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MI9/SvRRK8IVQYYncfKFlKwBoI6pxlSe/qB48GbTMGUxB24VOuZu19zoCnM4CJuVoc2ux7CAACK9RFyO0mT1PpJtyamwsc0Yh0wYXpdAkeE+givBpvZ4nVyeoFCehojsrAiHVbi3hGKCDeGxoWMR3j6iNwq4rz+T2N3SgkjZNfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 90A582D95; Tue, 1 Jul 2025 06:56:32 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BE61A3F58B; Tue, 1 Jul 2025 06:56:46 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Geert Uytterhoeven , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-m68k@lists.linux-m68k.org Subject: [PATCH 10/23] m68k: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:03 +0100 Message-Id: <20250701135616.29630-11-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Geert Uytterhoeven Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-m68k@lists.linux-m68k.org Acked-by: Geert Uytterhoeven Reviewed-by: Akihiko Odaki Reviewed-by: Geert Uytterhoeven --- arch/m68k/kernel/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c index c20d590e4297..cfa2df24eced 100644 --- a/arch/m68k/kernel/ptrace.c +++ b/arch/m68k/kernel/ptrace.c @@ -319,7 +319,7 @@ enum m68k_regset { =20 static const struct user_regset m68k_user_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(u32), .align =3D sizeof(u16), @@ -327,7 +327,7 @@ static const struct user_regset m68k_user_regsets[] =3D= { }, #ifdef CONFIG_FPU [REGSET_FPU] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct user_m68kfp_struct) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B0E52798E6; Tue, 1 Jul 2025 13:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378211; cv=none; b=mFrnNVKNjWaGLBjVj+UpwaHTPKCbtHyLmA4IRFRDxaQBqN3NCOfiNvETdV3ABTUAqt5jVyBs3poM5vH/khP769fwaGxCwyvKxkxzkAdBubF5mmCFjVZRaf3HwP6TCZxW+CbMu6Saxlyiwq+uQ/hgi4x1RoyWrrFBTNuS8B/Zs7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378211; c=relaxed/simple; bh=u99rUQTMdWLVEwxqQcav+sqGA2U6uY/gTG9CZE6Ajp8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UFDUVh0xI1G5MfU27y1uguYnMYCqVB1tziwvsa//fstNEfOMVyCb3I2xqrOIPzw0M2wilnEzSIHblvy0geOZWGS+lzTzSk58p44tA2Bmdc8QnV7uY+KxYCJJ5P899vPLZYrGGbOVU4vAuPrHC4IkIrYWVfQSq3f9fOB25WrZydI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 303DF2E99; Tue, 1 Jul 2025 06:56:34 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3DE563F58B; Tue, 1 Jul 2025 06:56:48 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Thomas Bogendoerfer , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-mips@vger.kernel.org Subject: [PATCH 11/23] MIPS: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:04 +0100 Message-Id: <20250701135616.29630-12-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Thomas Bogendoerfer Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-mips@vger.kernel.org Reviewed-by: Akihiko Odaki --- arch/mips/kernel/ptrace.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index b890d64d352c..3f4c94c88124 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -935,7 +935,7 @@ int regs_query_register_offset(const char *name) =20 static const struct user_regset mips_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(unsigned int), .align =3D sizeof(unsigned int), @@ -943,7 +943,7 @@ static const struct user_regset mips_regsets[] =3D { .set =3D gpr32_set, }, [REGSET_DSP] =3D { - .core_note_type =3D NT_MIPS_DSP, + USER_REGSET_NOTE_TYPE(MIPS_DSP), .n =3D NUM_DSP_REGS + 1, .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -953,7 +953,7 @@ static const struct user_regset mips_regsets[] =3D { }, #ifdef CONFIG_MIPS_FP_SUPPORT [REGSET_FPR] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(elf_fpreg_t), .align =3D sizeof(elf_fpreg_t), @@ -961,7 +961,7 @@ static const struct user_regset mips_regsets[] =3D { .set =3D fpr_set, }, [REGSET_FP_MODE] =3D { - .core_note_type =3D NT_MIPS_FP_MODE, + USER_REGSET_NOTE_TYPE(MIPS_FP_MODE), .n =3D 1, .size =3D sizeof(int), .align =3D sizeof(int), @@ -971,7 +971,7 @@ static const struct user_regset mips_regsets[] =3D { #endif #ifdef CONFIG_CPU_HAS_MSA [REGSET_MSA] =3D { - .core_note_type =3D NT_MIPS_MSA, + USER_REGSET_NOTE_TYPE(MIPS_MSA), .n =3D NUM_FPU_REGS + 1, .size =3D 16, .align =3D 16, @@ -995,7 +995,7 @@ static const struct user_regset_view user_mips_view =3D= { =20 static const struct user_regset mips64_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(unsigned long), .align =3D sizeof(unsigned long), @@ -1003,7 +1003,7 @@ static const struct user_regset mips64_regsets[] =3D { .set =3D gpr64_set, }, [REGSET_DSP] =3D { - .core_note_type =3D NT_MIPS_DSP, + USER_REGSET_NOTE_TYPE(MIPS_DSP), .n =3D NUM_DSP_REGS + 1, .size =3D sizeof(u64), .align =3D sizeof(u64), @@ -1013,7 +1013,7 @@ static const struct user_regset mips64_regsets[] =3D { }, #ifdef CONFIG_MIPS_FP_SUPPORT [REGSET_FP_MODE] =3D { - .core_note_type =3D NT_MIPS_FP_MODE, + USER_REGSET_NOTE_TYPE(MIPS_FP_MODE), .n =3D 1, .size =3D sizeof(int), .align =3D sizeof(int), @@ -1021,7 +1021,7 @@ static const struct user_regset mips64_regsets[] =3D { .set =3D fp_mode_set, }, [REGSET_FPR] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(elf_fpreg_t), .align =3D sizeof(elf_fpreg_t), @@ -1031,7 +1031,7 @@ static const struct user_regset mips64_regsets[] =3D { #endif #ifdef CONFIG_CPU_HAS_MSA [REGSET_MSA] =3D { - .core_note_type =3D NT_MIPS_MSA, + USER_REGSET_NOTE_TYPE(MIPS_MSA), .n =3D NUM_FPU_REGS + 1, .size =3D 16, .align =3D 16, --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11C38276038 for ; Tue, 1 Jul 2025 13:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378212; cv=none; b=QS1B9qtEqE3Oxo4IolJcMsQdP0QWQ9FhTaO6cBoOlcXf22OTvpqBcAdfkXIsgshoTjvNtQQkiQBkd9jjOe0LMUJ7sqiJqZk+cPL0iOdEahzvY6uoMXsDaIHzDvUH/+fRyog4s76Q1q0nKUfyuR4fyQR7qnzjkUXLYnqEOAbdaN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378212; c=relaxed/simple; bh=19AJDUxx7NF+xN6X50eYbEMXtITQkNa9S1m0FT5ZAz4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=alfjXqUiKDSSxijJkYO4JoHOS9asjGZ3tfXms2asiV8TG19eP84FA/NMQcxQTZgP/n1HEb0e3n5ucMt/6hG1nZ9YpFedc2hSWHt5yGBSjMgkdGwsPw2drLvjCbPSDv85gLSXu/OIS/ScsIznk6LOdcVNLBPdZCWB48LXIF8V/eg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 5FC102EC5; Tue, 1 Jul 2025 06:56:35 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B11C23F58B; Tue, 1 Jul 2025 06:56:49 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Dinh Nguyen , Oleg Nesterov , Kees Cook , Akihiko Odaki Subject: [PATCH 12/23] nios2: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:05 +0100 Message-Id: <20250701135616.29630-13-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Dinh Nguyen Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Reviewed-by: Akihiko Odaki --- arch/nios2/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/nios2/kernel/ptrace.c b/arch/nios2/kernel/ptrace.c index 9221c15972e6..c88f5cabc0c1 100644 --- a/arch/nios2/kernel/ptrace.c +++ b/arch/nios2/kernel/ptrace.c @@ -95,7 +95,7 @@ enum nios2_regset { =20 static const struct user_regset nios2_regsets[] =3D { [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D NUM_PTRACE_REG, .size =3D sizeof(unsigned long), .align =3D sizeof(unsigned long), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9C8F279DB4; Tue, 1 Jul 2025 13:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378214; cv=none; b=pPnsUaVkUXrWn4MvP48UqV53BaWb043lTmvEaZHp0T0/uZtbInSNo80Rpr3tEuraMHf+ERx7DLfcCzIrYZP6rMTPh7VPBBY8sSnQzc/Hndtt6vBTW0xtPTgcEgJR6n3nQJALp0OXIUskSWOygkwU5nft9Gw79hyLEX6U5q6U2I8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378214; c=relaxed/simple; bh=hj0xanUpqdv+cmAVO+ES1xky96bHgFEr4H5HxHqFIqE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UbTc/3JM2Yi1ViBYy7QIwIcBcE5F7P5w5r0fXzhA0BF0YkLc2cjHDbp1nHaS9m9vkEmt4ARBiFnWG9JWMDBEd4AmaEz33Fbu7prbpcTy/v5spzLrLrZ9EFr4usVAm/bA0oM2u1C9o3f6HcLxkMkgBP0uLHKbyMkWb5MYmJ/Gj94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 272072E9D; Tue, 1 Jul 2025 06:56:37 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D3E83F58B; Tue, 1 Jul 2025 06:56:50 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Jonas Bonn , Stefan Kristiansson , Stafford Horne , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-openrisc@vger.kernel.org Subject: [PATCH 13/23] openrisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:06 +0100 Message-Id: <20250701135616.29630-14-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Jonas Bonn Cc: Stefan Kristiansson Cc: Stafford Horne Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-openrisc@vger.kernel.org Reviewed-by: Akihiko Odaki --- arch/openrisc/kernel/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c index 8430570d0620..552489b24855 100644 --- a/arch/openrisc/kernel/ptrace.c +++ b/arch/openrisc/kernel/ptrace.c @@ -124,7 +124,7 @@ enum or1k_regset { =20 static const struct user_regset or1k_regsets[] =3D { [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(long), .align =3D sizeof(long), @@ -133,7 +133,7 @@ static const struct user_regset or1k_regsets[] =3D { }, #ifdef CONFIG_FPU [REGSET_FPU] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct __or1k_fpu_state) / sizeof(long), .size =3D sizeof(long), .align =3D sizeof(long), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AE8C27510C; Tue, 1 Jul 2025 13:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378215; cv=none; b=t0It36bEeYyltlAxLctn1wzzj4cfUqgtcAtV+ULUXtPKeuU3tqAeOHfl/Flq5vXG2D9TkOLzD9VZ0WfKvcssb1td4nSIh15R32DA61wMlqw93iQSqKg8Xv60pmuKTxXtj5aDMaTTHF6aT6/dqQKZpEbEc7XYsMKp+rvQ/kjn6BI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378215; c=relaxed/simple; bh=ox6i9QWjKiCmOoFpS4FdQnJUmMqGX3zS4XFhykMKXZU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ccwypCdeH/Wu9MGOTW9j1sR2aPTewYSJ+cPyFGg1COg/W/kBXE4MH0Uod1zISmPrrc7F0hpeL4HgkDrt6z9J5x87wxrBQrjUh+/z/9sDPYhpIaI0tnYVqZu+6zjhA1DheluZSMa7p3ttiTgknxUrtH1TB8P8KQq6rwSPb/BouLs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 BE9C32E91; Tue, 1 Jul 2025 06:56:38 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C86C33F58B; Tue, 1 Jul 2025 06:56:52 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: "James E.J. Bottomley" , Helge Deller , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-parisc@vger.kernel.org Subject: [PATCH 14/23] parisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:07 +0100 Message-Id: <20250701135616.29630-15-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-parisc@vger.kernel.org Reviewed-by: Akihiko Odaki --- arch/parisc/kernel/ptrace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index ceb45f51d52e..8a17ab7e6e0b 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c @@ -562,12 +562,12 @@ static int gpr_set(struct task_struct *target, =20 static const struct user_regset native_regsets[] =3D { [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, .n =3D ELF_NGREG, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(long), .align =3D sizeof(long), .regset_get =3D gpr_get, .set =3D gpr_set }, [REGSET_FP] =3D { - .core_note_type =3D NT_PRFPREG, .n =3D ELF_NFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(__u64), .align =3D sizeof(__u64), .regset_get =3D fpr_get, .set =3D fpr_set } @@ -629,12 +629,12 @@ static int gpr32_set(struct task_struct *target, */ static const struct user_regset compat_regsets[] =3D { [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, .n =3D ELF_NGREG, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(compat_long_t), .align =3D sizeof(compat_long_t), .regset_get =3D gpr32_get, .set =3D gpr32_set }, [REGSET_FP] =3D { - .core_note_type =3D NT_PRFPREG, .n =3D ELF_NFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(__u64), .align =3D sizeof(__u64), .regset_get =3D fpr_get, .set =3D fpr_set } --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65491276056 for ; Tue, 1 Jul 2025 13:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378218; cv=none; b=StPEhx+GXdBuWy1ksa57E1sykvIFQeah1KSofMQFeeQjGzqcBg/hXblfIcVmiiRZzi4seofBQHRMwEJ9gDG3p8+w8SxLPGbA4905fUOaq/mZdMsSn3LtT5PMZJQ80JM19ptvlIQwLDRArDwqEFAkXUkTYlErG/l/fUTFpZCsPZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378218; c=relaxed/simple; bh=QEecqqYm5ptJidNitchwQFGG978GrPeS1095Tw6Fcmw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J+l4JesmjiuKh7jKhScMKoqHSkkRDooKCTzW/rriFqgo2aFuiwiUBWYzeE+jJqyfsBya8oyGXXlPgbx5DJmkm8YXD50oOD9w5SlAulweUzQl91hBCJQfxr4FUMuARNGCoT3i2n4DytdHWvAFBlw9F66jji9YsrG/ZTOrTTI2T9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 AA1D22E98; Tue, 1 Jul 2025 06:56:40 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6CABC3F58B; Tue, 1 Jul 2025 06:56:54 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Oleg Nesterov , Kees Cook , Akihiko Odaki , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 15/23] powerpc/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:08 +0100 Message-Id: <20250701135616.29630-16-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Akihiko Odaki --- arch/powerpc/kernel/ptrace/ptrace-view.c | 74 ++++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c b/arch/powerpc/kernel= /ptrace/ptrace-view.c index c1819e0a6684..0310f9097e39 100644 --- a/arch/powerpc/kernel/ptrace/ptrace-view.c +++ b/arch/powerpc/kernel/ptrace/ptrace-view.c @@ -568,114 +568,114 @@ static int pkey_set(struct task_struct *target, con= st struct user_regset *regset =20 static const struct user_regset native_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, .n =3D ELF_NGREG, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(long), .align =3D sizeof(long), .regset_get =3D gpr_get, .set =3D gpr_set }, [REGSET_FPR] =3D { - .core_note_type =3D NT_PRFPREG, .n =3D ELF_NFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(double), .align =3D sizeof(double), .regset_get =3D fpr_get, .set =3D fpr_set }, #ifdef CONFIG_ALTIVEC [REGSET_VMX] =3D { - .core_note_type =3D NT_PPC_VMX, .n =3D 34, + USER_REGSET_NOTE_TYPE(PPC_VMX), .n =3D 34, .size =3D sizeof(vector128), .align =3D sizeof(vector128), .active =3D vr_active, .regset_get =3D vr_get, .set =3D vr_set }, #endif #ifdef CONFIG_VSX [REGSET_VSX] =3D { - .core_note_type =3D NT_PPC_VSX, .n =3D 32, + USER_REGSET_NOTE_TYPE(PPC_VSX), .n =3D 32, .size =3D sizeof(double), .align =3D sizeof(double), .active =3D vsr_active, .regset_get =3D vsr_get, .set =3D vsr_set }, #endif #ifdef CONFIG_SPE [REGSET_SPE] =3D { - .core_note_type =3D NT_PPC_SPE, .n =3D 35, + USER_REGSET_NOTE_TYPE(PPC_SPE), .n =3D 35, .size =3D sizeof(u32), .align =3D sizeof(u32), .active =3D evr_active, .regset_get =3D evr_get, .set =3D evr_set }, #endif #ifdef CONFIG_PPC_TRANSACTIONAL_MEM [REGSET_TM_CGPR] =3D { - .core_note_type =3D NT_PPC_TM_CGPR, .n =3D ELF_NGREG, + USER_REGSET_NOTE_TYPE(PPC_TM_CGPR), .n =3D ELF_NGREG, .size =3D sizeof(long), .align =3D sizeof(long), .active =3D tm_cgpr_active, .regset_get =3D tm_cgpr_get, .set =3D tm_cgp= r_set }, [REGSET_TM_CFPR] =3D { - .core_note_type =3D NT_PPC_TM_CFPR, .n =3D ELF_NFPREG, + USER_REGSET_NOTE_TYPE(PPC_TM_CFPR), .n =3D ELF_NFPREG, .size =3D sizeof(double), .align =3D sizeof(double), .active =3D tm_cfpr_active, .regset_get =3D tm_cfpr_get, .set =3D tm_cfp= r_set }, [REGSET_TM_CVMX] =3D { - .core_note_type =3D NT_PPC_TM_CVMX, .n =3D ELF_NVMX, + USER_REGSET_NOTE_TYPE(PPC_TM_CVMX), .n =3D ELF_NVMX, .size =3D sizeof(vector128), .align =3D sizeof(vector128), .active =3D tm_cvmx_active, .regset_get =3D tm_cvmx_get, .set =3D tm_cvm= x_set }, [REGSET_TM_CVSX] =3D { - .core_note_type =3D NT_PPC_TM_CVSX, .n =3D ELF_NVSX, + USER_REGSET_NOTE_TYPE(PPC_TM_CVSX), .n =3D ELF_NVSX, .size =3D sizeof(double), .align =3D sizeof(double), .active =3D tm_cvsx_active, .regset_get =3D tm_cvsx_get, .set =3D tm_cvs= x_set }, [REGSET_TM_SPR] =3D { - .core_note_type =3D NT_PPC_TM_SPR, .n =3D ELF_NTMSPRREG, + USER_REGSET_NOTE_TYPE(PPC_TM_SPR), .n =3D ELF_NTMSPRREG, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D tm_spr_active, .regset_get =3D tm_spr_get, .set =3D tm_spr_s= et }, [REGSET_TM_CTAR] =3D { - .core_note_type =3D NT_PPC_TM_CTAR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_TM_CTAR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D tm_tar_active, .regset_get =3D tm_tar_get, .set =3D tm_tar_s= et }, [REGSET_TM_CPPR] =3D { - .core_note_type =3D NT_PPC_TM_CPPR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_TM_CPPR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D tm_ppr_active, .regset_get =3D tm_ppr_get, .set =3D tm_ppr_s= et }, [REGSET_TM_CDSCR] =3D { - .core_note_type =3D NT_PPC_TM_CDSCR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_TM_CDSCR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D tm_dscr_active, .regset_get =3D tm_dscr_get, .set =3D tm_dsc= r_set }, #endif #ifdef CONFIG_PPC64 [REGSET_PPR] =3D { - .core_note_type =3D NT_PPC_PPR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_PPR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .regset_get =3D ppr_get, .set =3D ppr_set }, [REGSET_DSCR] =3D { - .core_note_type =3D NT_PPC_DSCR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_DSCR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .regset_get =3D dscr_get, .set =3D dscr_set }, #endif #ifdef CONFIG_PPC_BOOK3S_64 [REGSET_TAR] =3D { - .core_note_type =3D NT_PPC_TAR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_TAR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .regset_get =3D tar_get, .set =3D tar_set }, [REGSET_EBB] =3D { - .core_note_type =3D NT_PPC_EBB, .n =3D ELF_NEBB, + USER_REGSET_NOTE_TYPE(PPC_EBB), .n =3D ELF_NEBB, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D ebb_active, .regset_get =3D ebb_get, .set =3D ebb_set }, [REGSET_PMR] =3D { - .core_note_type =3D NT_PPC_PMU, .n =3D ELF_NPMU, + USER_REGSET_NOTE_TYPE(PPC_PMU), .n =3D ELF_NPMU, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D pmu_active, .regset_get =3D pmu_get, .set =3D pmu_set }, [REGSET_DEXCR] =3D { - .core_note_type =3D NT_PPC_DEXCR, .n =3D ELF_NDEXCR, + USER_REGSET_NOTE_TYPE(PPC_DEXCR), .n =3D ELF_NDEXCR, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D dexcr_active, .regset_get =3D dexcr_get }, #ifdef CONFIG_CHECKPOINT_RESTORE [REGSET_HASHKEYR] =3D { - .core_note_type =3D NT_PPC_HASHKEYR, .n =3D ELF_NHASHKEYR, + USER_REGSET_NOTE_TYPE(PPC_HASHKEYR), .n =3D ELF_NHASHKEYR, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D hashkeyr_active, .regset_get =3D hashkeyr_get, .set =3D hash= keyr_set }, @@ -683,7 +683,7 @@ static const struct user_regset native_regsets[] =3D { #endif #ifdef CONFIG_PPC_MEM_KEYS [REGSET_PKEY] =3D { - .core_note_type =3D NT_PPC_PKEY, .n =3D ELF_NPKEY, + USER_REGSET_NOTE_TYPE(PPC_PKEY), .n =3D ELF_NPKEY, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D pkey_active, .regset_get =3D pkey_get, .set =3D pkey_set }, @@ -843,92 +843,92 @@ static int gpr32_set(struct task_struct *target, */ static const struct user_regset compat_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, .n =3D ELF_NGREG, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(compat_long_t), .align =3D sizeof(compat_long_t), .regset_get =3D gpr32_get, .set =3D gpr32_set }, [REGSET_FPR] =3D { - .core_note_type =3D NT_PRFPREG, .n =3D ELF_NFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(double), .align =3D sizeof(double), .regset_get =3D fpr_get, .set =3D fpr_set }, #ifdef CONFIG_ALTIVEC [REGSET_VMX] =3D { - .core_note_type =3D NT_PPC_VMX, .n =3D 34, + USER_REGSET_NOTE_TYPE(PPC_VMX), .n =3D 34, .size =3D sizeof(vector128), .align =3D sizeof(vector128), .active =3D vr_active, .regset_get =3D vr_get, .set =3D vr_set }, #endif #ifdef CONFIG_SPE [REGSET_SPE] =3D { - .core_note_type =3D NT_PPC_SPE, .n =3D 35, + USER_REGSET_NOTE_TYPE(PPC_SPE), .n =3D 35, .size =3D sizeof(u32), .align =3D sizeof(u32), .active =3D evr_active, .regset_get =3D evr_get, .set =3D evr_set }, #endif #ifdef CONFIG_PPC_TRANSACTIONAL_MEM [REGSET_TM_CGPR] =3D { - .core_note_type =3D NT_PPC_TM_CGPR, .n =3D ELF_NGREG, + USER_REGSET_NOTE_TYPE(PPC_TM_CGPR), .n =3D ELF_NGREG, .size =3D sizeof(long), .align =3D sizeof(long), .active =3D tm_cgpr_active, .regset_get =3D tm_cgpr32_get, .set =3D tm_cgpr32_set }, [REGSET_TM_CFPR] =3D { - .core_note_type =3D NT_PPC_TM_CFPR, .n =3D ELF_NFPREG, + USER_REGSET_NOTE_TYPE(PPC_TM_CFPR), .n =3D ELF_NFPREG, .size =3D sizeof(double), .align =3D sizeof(double), .active =3D tm_cfpr_active, .regset_get =3D tm_cfpr_get, .set =3D tm_cfp= r_set }, [REGSET_TM_CVMX] =3D { - .core_note_type =3D NT_PPC_TM_CVMX, .n =3D ELF_NVMX, + USER_REGSET_NOTE_TYPE(PPC_TM_CVMX), .n =3D ELF_NVMX, .size =3D sizeof(vector128), .align =3D sizeof(vector128), .active =3D tm_cvmx_active, .regset_get =3D tm_cvmx_get, .set =3D tm_cvm= x_set }, [REGSET_TM_CVSX] =3D { - .core_note_type =3D NT_PPC_TM_CVSX, .n =3D ELF_NVSX, + USER_REGSET_NOTE_TYPE(PPC_TM_CVSX), .n =3D ELF_NVSX, .size =3D sizeof(double), .align =3D sizeof(double), .active =3D tm_cvsx_active, .regset_get =3D tm_cvsx_get, .set =3D tm_cvs= x_set }, [REGSET_TM_SPR] =3D { - .core_note_type =3D NT_PPC_TM_SPR, .n =3D ELF_NTMSPRREG, + USER_REGSET_NOTE_TYPE(PPC_TM_SPR), .n =3D ELF_NTMSPRREG, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D tm_spr_active, .regset_get =3D tm_spr_get, .set =3D tm_spr_s= et }, [REGSET_TM_CTAR] =3D { - .core_note_type =3D NT_PPC_TM_CTAR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_TM_CTAR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D tm_tar_active, .regset_get =3D tm_tar_get, .set =3D tm_tar_s= et }, [REGSET_TM_CPPR] =3D { - .core_note_type =3D NT_PPC_TM_CPPR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_TM_CPPR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D tm_ppr_active, .regset_get =3D tm_ppr_get, .set =3D tm_ppr_s= et }, [REGSET_TM_CDSCR] =3D { - .core_note_type =3D NT_PPC_TM_CDSCR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_TM_CDSCR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D tm_dscr_active, .regset_get =3D tm_dscr_get, .set =3D tm_dsc= r_set }, #endif #ifdef CONFIG_PPC64 [REGSET_PPR] =3D { - .core_note_type =3D NT_PPC_PPR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_PPR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .regset_get =3D ppr_get, .set =3D ppr_set }, [REGSET_DSCR] =3D { - .core_note_type =3D NT_PPC_DSCR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_DSCR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .regset_get =3D dscr_get, .set =3D dscr_set }, #endif #ifdef CONFIG_PPC_BOOK3S_64 [REGSET_TAR] =3D { - .core_note_type =3D NT_PPC_TAR, .n =3D 1, + USER_REGSET_NOTE_TYPE(PPC_TAR), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), .regset_get =3D tar_get, .set =3D tar_set }, [REGSET_EBB] =3D { - .core_note_type =3D NT_PPC_EBB, .n =3D ELF_NEBB, + USER_REGSET_NOTE_TYPE(PPC_EBB), .n =3D ELF_NEBB, .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D ebb_active, .regset_get =3D ebb_get, .set =3D ebb_set }, --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86EB827A929 for ; Tue, 1 Jul 2025 13:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378220; cv=none; b=uw+9NZPvdCJtDbVnLCBUf+Zx9PhQdTiV6VSuhsT2pIXlC2Gv6pNcgAkeecQafgDxKaaNtBo8lobO+lWTzc9vZo1AbBRz5pF12GS7J2bSUONmUd9Utc2gAVe5gu5+gVj8e2emCVSbgysYTlbbOlkCaa5ObsGKDImw8ikxDjbsv8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378220; c=relaxed/simple; bh=AAX0iPBJOCozDEx8Jg2VqOvV+HH/ZWLZpQ4wKqZ0Kog=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XRzLjt8bhXfX9zk20D43Hd22xEnfFDd1bY2FsWD2UOLRjhOd44K/yliC+SI68YTrD4Xajc44q9BJdhGSCmqs6wiOSffJWuXechOFZO5+VjKOPzjiMxr0wvOyj+sN3+ehrtPBBp9GatpPtlJzcv2M1UaGHGQrWRJR9+lgtRNdO54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 9573A2ED2; Tue, 1 Jul 2025 06:56:42 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 57E923F58B; Tue, 1 Jul 2025 06:56:56 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-riscv@lists.infradead.org Subject: [PATCH 16/23] riscv: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:09 +0100 Message-Id: <20250701135616.29630-17-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: Alexandre Ghiti Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-riscv@lists.infradead.org Reviewed-by: Akihiko Odaki --- arch/riscv/kernel/ptrace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c index ea67e9fb7a58..8e86305831ea 100644 --- a/arch/riscv/kernel/ptrace.c +++ b/arch/riscv/kernel/ptrace.c @@ -186,7 +186,7 @@ static int tagged_addr_ctrl_set(struct task_struct *tar= get, =20 static const struct user_regset riscv_user_regset[] =3D { [REGSET_X] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(elf_greg_t), .align =3D sizeof(elf_greg_t), @@ -195,7 +195,7 @@ static const struct user_regset riscv_user_regset[] =3D= { }, #ifdef CONFIG_FPU [REGSET_F] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(elf_fpreg_t), .align =3D sizeof(elf_fpreg_t), @@ -205,7 +205,7 @@ static const struct user_regset riscv_user_regset[] =3D= { #endif #ifdef CONFIG_RISCV_ISA_V [REGSET_V] =3D { - .core_note_type =3D NT_RISCV_VECTOR, + USER_REGSET_NOTE_TYPE(RISCV_VECTOR), .align =3D 16, .n =3D ((32 * RISCV_MAX_VLENB) + sizeof(struct __riscv_v_regset_state)) / sizeof(__u32), @@ -216,7 +216,7 @@ static const struct user_regset riscv_user_regset[] =3D= { #endif #ifdef CONFIG_RISCV_ISA_SUPM [REGSET_TAGGED_ADDR_CTRL] =3D { - .core_note_type =3D NT_RISCV_TAGGED_ADDR_CTRL, + USER_REGSET_NOTE_TYPE(RISCV_TAGGED_ADDR_CTRL), .n =3D 1, .size =3D sizeof(long), .align =3D sizeof(long), @@ -380,7 +380,7 @@ static int compat_riscv_gpr_set(struct task_struct *tar= get, =20 static const struct user_regset compat_riscv_user_regset[] =3D { [REGSET_X] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(compat_elf_greg_t), .align =3D sizeof(compat_elf_greg_t), @@ -389,7 +389,7 @@ static const struct user_regset compat_riscv_user_regse= t[] =3D { }, #ifdef CONFIG_FPU [REGSET_F] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D ELF_NFPREG, .size =3D sizeof(elf_fpreg_t), .align =3D sizeof(elf_fpreg_t), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D8EA27BF6F; Tue, 1 Jul 2025 13:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378222; cv=none; b=KA50QRqBYREjbmoc0WDLmd9e3EU3sW9SStRXZdiJi6H/V02vsbJ3Mkk4f4aJOmZqauL4xw9cnJixTscqKBCAfyjFTnimdujsl+Z7rH8zHfvZI55dnrGIPMFivRWvck6/IOQ1ArIsC30vpf6IEJUKulNxRaaMzoprVrFb+ajzlJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378222; c=relaxed/simple; bh=ksjSGJsA16QDgnP8ZRbvd8mS8M+1nfxBIUQwECqghLk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kSQ0IUL/Z8Sr8jswA36aTj2gfOmzJjSy/wmnNcR0GBiDPsIKQ377RHFTIwTURSOadO3JkeMJ+3uUvMIixdpfMBetahCl1Wj899iwsq0Qwd7uH4B7EQXkjBpWOaPaTk+aYXF1xQYoNLx1hHsgkAOG1cBvcrpzE4hFQqQwv678pSI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 A4DBE2E96; Tue, 1 Jul 2025 06:56:44 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 437A43F58B; Tue, 1 Jul 2025 06:56:58 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-s390@vger.kernel.org Subject: [PATCH 17/23] s390/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:10 +0100 Message-Id: <20250701135616.29630-18-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Alexander Gordeev Cc: Christian Borntraeger Cc: Sven Schnelle Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-s390@vger.kernel.org Acked-by: Alexander Gordeev Reviewed-by: Akihiko Odaki --- arch/s390/kernel/ptrace.c | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index e1240f6b29fa..494216c4b4f3 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c @@ -1209,7 +1209,7 @@ static int s390_runtime_instr_set(struct task_struct = *target, =20 static const struct user_regset s390_regsets[] =3D { { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D sizeof(s390_regs) / sizeof(long), .size =3D sizeof(long), .align =3D sizeof(long), @@ -1217,7 +1217,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_regs_set, }, { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(s390_fp_regs) / sizeof(long), .size =3D sizeof(long), .align =3D sizeof(long), @@ -1225,7 +1225,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_fpregs_set, }, { - .core_note_type =3D NT_S390_SYSTEM_CALL, + USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL), .n =3D 1, .size =3D sizeof(unsigned int), .align =3D sizeof(unsigned int), @@ -1233,7 +1233,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_system_call_set, }, { - .core_note_type =3D NT_S390_LAST_BREAK, + USER_REGSET_NOTE_TYPE(S390_LAST_BREAK), .n =3D 1, .size =3D sizeof(long), .align =3D sizeof(long), @@ -1241,7 +1241,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_last_break_set, }, { - .core_note_type =3D NT_S390_TDB, + USER_REGSET_NOTE_TYPE(S390_TDB), .n =3D 1, .size =3D 256, .align =3D 1, @@ -1249,7 +1249,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_tdb_set, }, { - .core_note_type =3D NT_S390_VXRS_LOW, + USER_REGSET_NOTE_TYPE(S390_VXRS_LOW), .n =3D __NUM_VXRS_LOW, .size =3D sizeof(__u64), .align =3D sizeof(__u64), @@ -1257,7 +1257,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_vxrs_low_set, }, { - .core_note_type =3D NT_S390_VXRS_HIGH, + USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH), .n =3D __NUM_VXRS_HIGH, .size =3D sizeof(__vector128), .align =3D sizeof(__vector128), @@ -1265,7 +1265,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_vxrs_high_set, }, { - .core_note_type =3D NT_S390_GS_CB, + USER_REGSET_NOTE_TYPE(S390_GS_CB), .n =3D sizeof(struct gs_cb) / sizeof(__u64), .size =3D sizeof(__u64), .align =3D sizeof(__u64), @@ -1273,7 +1273,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_gs_cb_set, }, { - .core_note_type =3D NT_S390_GS_BC, + USER_REGSET_NOTE_TYPE(S390_GS_BC), .n =3D sizeof(struct gs_cb) / sizeof(__u64), .size =3D sizeof(__u64), .align =3D sizeof(__u64), @@ -1281,7 +1281,7 @@ static const struct user_regset s390_regsets[] =3D { .set =3D s390_gs_bc_set, }, { - .core_note_type =3D NT_S390_RI_CB, + USER_REGSET_NOTE_TYPE(S390_RI_CB), .n =3D sizeof(struct runtime_instr_cb) / sizeof(__u64), .size =3D sizeof(__u64), .align =3D sizeof(__u64), @@ -1413,7 +1413,7 @@ static int s390_compat_last_break_set(struct task_str= uct *target, =20 static const struct user_regset s390_compat_regsets[] =3D { { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D sizeof(s390_compat_regs) / sizeof(compat_long_t), .size =3D sizeof(compat_long_t), .align =3D sizeof(compat_long_t), @@ -1421,7 +1421,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_compat_regs_set, }, { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(s390_fp_regs) / sizeof(compat_long_t), .size =3D sizeof(compat_long_t), .align =3D sizeof(compat_long_t), @@ -1429,7 +1429,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_fpregs_set, }, { - .core_note_type =3D NT_S390_SYSTEM_CALL, + USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL), .n =3D 1, .size =3D sizeof(compat_uint_t), .align =3D sizeof(compat_uint_t), @@ -1437,7 +1437,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_system_call_set, }, { - .core_note_type =3D NT_S390_LAST_BREAK, + USER_REGSET_NOTE_TYPE(S390_LAST_BREAK), .n =3D 1, .size =3D sizeof(long), .align =3D sizeof(long), @@ -1445,7 +1445,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_compat_last_break_set, }, { - .core_note_type =3D NT_S390_TDB, + USER_REGSET_NOTE_TYPE(S390_TDB), .n =3D 1, .size =3D 256, .align =3D 1, @@ -1453,7 +1453,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_tdb_set, }, { - .core_note_type =3D NT_S390_VXRS_LOW, + USER_REGSET_NOTE_TYPE(S390_VXRS_LOW), .n =3D __NUM_VXRS_LOW, .size =3D sizeof(__u64), .align =3D sizeof(__u64), @@ -1461,7 +1461,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_vxrs_low_set, }, { - .core_note_type =3D NT_S390_VXRS_HIGH, + USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH), .n =3D __NUM_VXRS_HIGH, .size =3D sizeof(__vector128), .align =3D sizeof(__vector128), @@ -1469,7 +1469,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_vxrs_high_set, }, { - .core_note_type =3D NT_S390_HIGH_GPRS, + USER_REGSET_NOTE_TYPE(S390_HIGH_GPRS), .n =3D sizeof(s390_compat_regs_high) / sizeof(compat_long_t), .size =3D sizeof(compat_long_t), .align =3D sizeof(compat_long_t), @@ -1477,7 +1477,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_compat_regs_high_set, }, { - .core_note_type =3D NT_S390_GS_CB, + USER_REGSET_NOTE_TYPE(S390_GS_CB), .n =3D sizeof(struct gs_cb) / sizeof(__u64), .size =3D sizeof(__u64), .align =3D sizeof(__u64), @@ -1485,7 +1485,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_gs_cb_set, }, { - .core_note_type =3D NT_S390_GS_BC, + USER_REGSET_NOTE_TYPE(S390_GS_BC), .n =3D sizeof(struct gs_cb) / sizeof(__u64), .size =3D sizeof(__u64), .align =3D sizeof(__u64), @@ -1493,7 +1493,7 @@ static const struct user_regset s390_compat_regsets[]= =3D { .set =3D s390_gs_bc_set, }, { - .core_note_type =3D NT_S390_RI_CB, + USER_REGSET_NOTE_TYPE(S390_RI_CB), .n =3D sizeof(struct runtime_instr_cb) / sizeof(__u64), .size =3D sizeof(__u64), .align =3D sizeof(__u64), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49D0E27CCEE; Tue, 1 Jul 2025 13:57:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378224; cv=none; b=VdqRgn9T2tBDuu0rbPXOX1VNkBZwvbX83M5MeMJdzB5I7O8RcsFl/vS53TeBZOhYv29eO7ioSxf7MDrnwL9/XlzHAKVCIRGjupekbBC0yWRJzmpvtUTQYe2FqPAc2WLjarPkVwvKjf/hbDbQwxjNY5r0YgxsN4vgpTMNom73Cmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378224; c=relaxed/simple; bh=emrIt1jwMG6e8kMZ1aiwJ+UL6mDNQoGRBlRr53mFPnA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DWKQS1h/THipWdWJk7lthBtZ3BasYU75KUGqRJknLXo+ZyLsQolO5FSmLmhAi/+RL9bKuH32Fut0hXH6xu/CU5p1THe7Qkg9UT6i9FTXvpdlgzL3yng3JU5EFLxKDMVY8IzFC4rMwaX4KA5N66pmWb2lp/HklpjifQSCrYSwRw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 6C8F82F27; Tue, 1 Jul 2025 06:56:46 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 526543F58B; Tue, 1 Jul 2025 06:57:00 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-sh@vger.kernel.org Subject: [PATCH 18/23] sh: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:11 +0100 Message-Id: <20250701135616.29630-19-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Yoshinori Sato Cc: Rich Felker Cc: John Paul Adrian Glaubitz Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-sh@vger.kernel.org Reviewed-by: Akihiko Odaki --- arch/sh/kernel/ptrace_32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c index 36f50ad81e83..06f765d71a29 100644 --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c @@ -291,7 +291,7 @@ static const struct user_regset sh_regsets[] =3D { * PC, PR, SR, GBR, MACH, MACL, TRA */ [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D ELF_NGREG, .size =3D sizeof(long), .align =3D sizeof(long), @@ -301,7 +301,7 @@ static const struct user_regset sh_regsets[] =3D { =20 #ifdef CONFIG_SH_FPU [REGSET_FPU] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct user_fpu_struct) / sizeof(long), .size =3D sizeof(long), .align =3D sizeof(long), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B719827CCE7; Tue, 1 Jul 2025 13:57:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378225; cv=none; b=USA1a+dpC9l+zBUvgc8+3MORFNgG96aKWKFkzw9Swbwj1Ltxvp5pk6vxOZ8HeRIT9BEfcG64cACVTbWOYYg5YQ9yEaDmEWDyG7yqVucijKPy2fenI2v33U5O30fYlG7RyNX60nBPTLESrge9A0uE69tzLtMH+OkkzTgcpJ3rBM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378225; c=relaxed/simple; bh=d4Nv715iVso4a24D+ONygCJMrkBaGt6upCgmBSm/1jI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E7He0mW6u4X4mvkAZGblPpAJNnZEVIXZKaw3M25+fHNsZujzT12DdB+NG/RKuiYajHom8weU+F16eo9AEQX8amuRbtZS5iOyRj7p7589MCzrEbe2pp57B4XWmXmfYPdSWp+4WaBigtzj/9jt6va5Y3N/+xxyceJ3iDDmUiM5fcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 0FB5B2F28; Tue, 1 Jul 2025 06:56:48 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 195AA3F58B; Tue, 1 Jul 2025 06:57:01 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: "David S. Miller" , Andreas Larsson , Oleg Nesterov , Kees Cook , Akihiko Odaki , sparclinux@vger.kernel.org Subject: [PATCH 19/23] sparc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:12 +0100 Message-Id: <20250701135616.29630-20-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: "David S. Miller" Cc: Andreas Larsson Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: sparclinux@vger.kernel.org Reviewed-by: Akihiko Odaki --- arch/sparc/kernel/ptrace_32.c | 4 ++-- arch/sparc/kernel/ptrace_64.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c index c273ccebea46..c56333975fb1 100644 --- a/arch/sparc/kernel/ptrace_32.c +++ b/arch/sparc/kernel/ptrace_32.c @@ -218,7 +218,7 @@ static const struct user_regset sparc32_regsets[] =3D { * PSR, PC, nPC, Y, WIM, TBR */ [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D 38, .size =3D sizeof(u32), .align =3D sizeof(u32), .regset_get =3D genregs32_get, .set =3D genregs32_set @@ -234,7 +234,7 @@ static const struct user_regset sparc32_regsets[] =3D { * FPU QUEUE (64 32-bit ints) */ [REGSET_FP] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D 99, .size =3D sizeof(u32), .align =3D sizeof(u32), .regset_get =3D fpregs32_get, .set =3D fpregs32_set diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c index 4deba5b6eddb..9fc67fa9336f 100644 --- a/arch/sparc/kernel/ptrace_64.c +++ b/arch/sparc/kernel/ptrace_64.c @@ -420,7 +420,7 @@ static const struct user_regset sparc64_regsets[] =3D { * TSTATE, TPC, TNPC, Y */ [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D 36, .size =3D sizeof(u64), .align =3D sizeof(u64), .regset_get =3D genregs64_get, .set =3D genregs64_set @@ -432,7 +432,7 @@ static const struct user_regset sparc64_regsets[] =3D { * FPRS */ [REGSET_FP] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D 35, .size =3D sizeof(u64), .align =3D sizeof(u64), .regset_get =3D fpregs64_get, .set =3D fpregs64_set @@ -750,7 +750,7 @@ static const struct user_regset sparc32_regsets[] =3D { * PSR, PC, nPC, Y, WIM, TBR */ [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D 38, .size =3D sizeof(u32), .align =3D sizeof(u32), .regset_get =3D genregs32_get, .set =3D genregs32_set @@ -766,7 +766,7 @@ static const struct user_regset sparc32_regsets[] =3D { * FPU QUEUE (64 32-bit ints) */ [REGSET_FP] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D 99, .size =3D sizeof(u32), .align =3D sizeof(u32), .regset_get =3D fpregs32_get, .set =3D fpregs32_set --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE63827EC73 for ; Tue, 1 Jul 2025 13:57:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378227; cv=none; b=KJR+PNZNfq0UYAwYP+H5lw31mOOQeQwIk++Fzyd17+AfhblBrwt50WLT554uqS4CjXsVhqL3pUmCEWN/l3qfRdNcbrWN9x/lfqy9Qp3wvNPg4lnv2iTgmkd+Dx0g9ISdLfsSjvqpnJ3SK6LgSOqbN02DEpsl0Kd/uU6x4daFO18= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378227; c=relaxed/simple; bh=oJJGSSQc4j6H3A33cfZyxTTalHG3CGfOj84UsBWoA4Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YHiIWM0I70wbZgQ5qgOwc79fv1N0VuMJltmrYGbHK2vq3jYIPpcg7E72yWg//ltEs62qwjjU/tQvnBmLwK4UMafGq3wrgytob2juDjLqc/r2vWvwJ9UvD6zNvj9W89s49cJmuKkBqkabpBXsy1iE9RvA/hKQEhMr26Ym6DApwyg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 1EB432F60; Tue, 1 Jul 2025 06:56:50 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B13FC3F58B; Tue, 1 Jul 2025 06:57:03 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Oleg Nesterov , Kees Cook , Akihiko Odaki , x86@kernel.org Subject: [PATCH 20/23] x86/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:13 +0100 Message-Id: <20250701135616.29630-21-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: x86@kernel.org Reviewed-by: Akihiko Odaki --- arch/x86/kernel/ptrace.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 095f04bdabdc..3dcadc13f09a 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -1236,7 +1236,7 @@ long compat_arch_ptrace(struct task_struct *child, co= mpat_long_t request, =20 static struct user_regset x86_64_regsets[] __ro_after_init =3D { [REGSET64_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D sizeof(struct user_regs_struct) / sizeof(long), .size =3D sizeof(long), .align =3D sizeof(long), @@ -1244,7 +1244,7 @@ static struct user_regset x86_64_regsets[] __ro_after= _init =3D { .set =3D genregs_set }, [REGSET64_FP] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct fxregs_state) / sizeof(long), .size =3D sizeof(long), .align =3D sizeof(long), @@ -1253,7 +1253,7 @@ static struct user_regset x86_64_regsets[] __ro_after= _init =3D { .set =3D xfpregs_set }, [REGSET64_XSTATE] =3D { - .core_note_type =3D NT_X86_XSTATE, + USER_REGSET_NOTE_TYPE(X86_XSTATE), .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D xstateregs_active, @@ -1261,7 +1261,7 @@ static struct user_regset x86_64_regsets[] __ro_after= _init =3D { .set =3D xstateregs_set }, [REGSET64_IOPERM] =3D { - .core_note_type =3D NT_386_IOPERM, + USER_REGSET_NOTE_TYPE(386_IOPERM), .n =3D IO_BITMAP_LONGS, .size =3D sizeof(long), .align =3D sizeof(long), @@ -1270,7 +1270,7 @@ static struct user_regset x86_64_regsets[] __ro_after= _init =3D { }, #ifdef CONFIG_X86_USER_SHADOW_STACK [REGSET64_SSP] =3D { - .core_note_type =3D NT_X86_SHSTK, + USER_REGSET_NOTE_TYPE(X86_SHSTK), .n =3D 1, .size =3D sizeof(u64), .align =3D sizeof(u64), @@ -1297,7 +1297,7 @@ static const struct user_regset_view user_x86_64_view= =3D { #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION static struct user_regset x86_32_regsets[] __ro_after_init =3D { [REGSET32_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D sizeof(struct user_regs_struct32) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -1305,7 +1305,7 @@ static struct user_regset x86_32_regsets[] __ro_after= _init =3D { .set =3D genregs32_set }, [REGSET32_FP] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct user_i387_ia32_struct) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -1314,7 +1314,7 @@ static struct user_regset x86_32_regsets[] __ro_after= _init =3D { .set =3D fpregs_set }, [REGSET32_XFP] =3D { - .core_note_type =3D NT_PRXFPREG, + USER_REGSET_NOTE_TYPE(PRXFPREG), .n =3D sizeof(struct fxregs_state) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -1323,7 +1323,7 @@ static struct user_regset x86_32_regsets[] __ro_after= _init =3D { .set =3D xfpregs_set }, [REGSET32_XSTATE] =3D { - .core_note_type =3D NT_X86_XSTATE, + USER_REGSET_NOTE_TYPE(X86_XSTATE), .size =3D sizeof(u64), .align =3D sizeof(u64), .active =3D xstateregs_active, @@ -1331,7 +1331,7 @@ static struct user_regset x86_32_regsets[] __ro_after= _init =3D { .set =3D xstateregs_set }, [REGSET32_TLS] =3D { - .core_note_type =3D NT_386_TLS, + USER_REGSET_NOTE_TYPE(386_TLS), .n =3D GDT_ENTRY_TLS_ENTRIES, .bias =3D GDT_ENTRY_TLS_MIN, .size =3D sizeof(struct user_desc), @@ -1341,7 +1341,7 @@ static struct user_regset x86_32_regsets[] __ro_after= _init =3D { .set =3D regset_tls_set }, [REGSET32_IOPERM] =3D { - .core_note_type =3D NT_386_IOPERM, + USER_REGSET_NOTE_TYPE(386_IOPERM), .n =3D IO_BITMAP_BYTES / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70E8127F160 for ; Tue, 1 Jul 2025 13:57:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378230; cv=none; b=JU4zlp4sqZp1cKm9vRymmD0PefbYdEFLeF0BU0pyxR21bGfkWU0DC6NV6iXsuARvXU985DvswizVlFuV2ju73JqY2cJ/4vXcLXR9Euf1y/GsqsSIsYh42aUBEp7PHjtT3Vp1xI/Xi3SELzeeUnOmdAjQCThCBDgwMBALIx2TDy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378230; c=relaxed/simple; bh=mBa622U6pXefIiJyrD9MBioY7AjrmbwcSnWuYKTyB+U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=G7FIjzuo/zFl1t1RAqiJKN6mSmlUfJtW7nRsbU56IyUgfjtHXKylfTciCQoXW4m7vVoaq/drMqJ06WL8aPdG2VfIp/or8ejVCp5IaXTWkMACdNJXsRCueYqclqBaSsdgccJly86EB4iLPdAuJ+eNQXVDavjTAeFjrnGhFQXWfWE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 BD4822EC6; Tue, 1 Jul 2025 06:56:52 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C0EE73F58B; Tue, 1 Jul 2025 06:57:05 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Oleg Nesterov , Kees Cook , Akihiko Odaki , linux-um@lists.infradead.org, x86@kernel.org Subject: [PATCH 21/23] um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:14 +0100 Message-Id: <20250701135616.29630-22-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-um@lists.infradead.org Cc: x86@kernel.org Acked-by: Johannes Berg Reviewed-by: Akihiko Odaki Tested-by: Johannes Berg --- arch/x86/um/ptrace.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/um/ptrace.c b/arch/x86/um/ptrace.c index 3275870330fe..c982ab7103f1 100644 --- a/arch/x86/um/ptrace.c +++ b/arch/x86/um/ptrace.c @@ -236,7 +236,7 @@ static int generic_fpregs_set(struct task_struct *targe= t, =20 static struct user_regset uml_regsets[] __ro_after_init =3D { [REGSET_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D sizeof(struct user_regs_struct) / sizeof(long), .size =3D sizeof(long), .align =3D sizeof(long), @@ -246,7 +246,7 @@ static struct user_regset uml_regsets[] __ro_after_init= =3D { #ifdef CONFIG_X86_32 /* Old FP registers, they are needed in signal frames */ [REGSET_FP_LEGACY] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct user_i387_ia32_struct) / sizeof(long), .size =3D sizeof(long), .align =3D sizeof(long), @@ -257,10 +257,10 @@ static struct user_regset uml_regsets[] __ro_after_in= it =3D { #endif [REGSET_FP] =3D { #ifdef CONFIG_X86_32 - .core_note_type =3D NT_PRXFPREG, + USER_REGSET_NOTE_TYPE(PRXFPREG), .n =3D sizeof(struct user32_fxsr_struct) / sizeof(long), #else - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(struct user_i387_struct) / sizeof(long), #endif .size =3D sizeof(long), @@ -270,7 +270,7 @@ static struct user_regset uml_regsets[] __ro_after_init= =3D { .set =3D generic_fpregs_set, }, [REGSET_XSTATE] =3D { - .core_note_type =3D NT_X86_XSTATE, + USER_REGSET_NOTE_TYPE(X86_XSTATE), .size =3D sizeof(long), .align =3D sizeof(long), .active =3D generic_fpregs_active, --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F191427F18C for ; Tue, 1 Jul 2025 13:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378231; cv=none; b=l3gguJP5Jn3AW9NOWXojMoRH6JHIxkT/qVevrRrT050cjIllZPGgERhqQb5u2/kzEcn+Tuc3pZMQWlJrIB1BpfcCM0c7L0tlSxCHLxbEO+ZLcsBa5YvsmHEHTs0CBdStgI+ot5QtC04SMrtCkXgflK/zT9F0csX1HSu4emyTrx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378231; c=relaxed/simple; bh=nkf3sQ7q7SJbL/+5fAV0ezxYJVbd/mAcUBUYHmZnM7s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y0T6uR7haxf3K/qgHlcPtV4aj5lkx9Pgd9lq+eshSaBtT1QcSfomsQsf3rjHFDvX0/UJS/pcGXDl9z9jr/APp/RKv9QxuKI5FfU/y7HWXwVviR0sp+wyuqapJCveMSt1eZ7WucvxoK0Vj2RQQqbjvPhpFqkU9JIQclJP21MqBBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 3CEFF2F7D; Tue, 1 Jul 2025 06:56:54 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6A21B3F58B; Tue, 1 Jul 2025 06:57:08 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Chris Zankel , Max Filippov , Oleg Nesterov , Kees Cook , Akihiko Odaki Subject: [PATCH 22/23] xtensa: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Date: Tue, 1 Jul 2025 14:56:15 +0100 Message-Id: <20250701135616.29630-23-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Chris Zankel Cc: Max Filippov Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Reviewed-by: Akihiko Odaki --- arch/xtensa/kernel/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c index 9056cd1a8302..ff0600a0584c 100644 --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c @@ -193,7 +193,7 @@ enum xtensa_regset { =20 static const struct user_regset xtensa_regsets[] =3D { [REGSET_GPR] =3D { - .core_note_type =3D NT_PRSTATUS, + USER_REGSET_NOTE_TYPE(PRSTATUS), .n =3D sizeof(struct user_pt_regs) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), @@ -201,7 +201,7 @@ static const struct user_regset xtensa_regsets[] =3D { .set =3D gpr_set, }, [REGSET_TIE] =3D { - .core_note_type =3D NT_PRFPREG, + USER_REGSET_NOTE_TYPE(PRFPREG), .n =3D sizeof(elf_xtregs_t) / sizeof(u32), .size =3D sizeof(u32), .align =3D sizeof(u32), --=20 2.34.1 From nobody Wed Oct 8 05:57:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E66827F74B for ; Tue, 1 Jul 2025 13:57:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378232; cv=none; b=UQPPai494XVO/usgTp5TODi74XvMsxYBX8XTRWe5jxYeDbVhIvQrdzTWlBw2Jii9rYtknMlPIWUxfGY/ofmdk0DeufQlbiShGHFgkTayrR87CVoSGJtK/x/gBcPwIKngg0pj5oW3p97lsAso/bpFQR4KxrnrV6rDQ5fUeOLVpUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378232; c=relaxed/simple; bh=vdVubaR2jthmhWrQkQs0ZqEnC3ZXQ6ikDWg6lQMR8+g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PzopCqT2tr0EjLkB2aKE4SSVYlN89rsnrBDzQWzMJMuTrjQ5MxuZhSb/ExZob6oi8KunWCHSZePOnDN3Z3HzKVMqVwlQgWz+mxrZ2ZXI8zaAqBdMSDV1eQIiV981sIHyZWibUYKvWTpMHGA/67/JMM4s1H6eW8qxW9TJ1iSe6Wc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 68DBB2F9D; Tue, 1 Jul 2025 06:56:55 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DDCC53F58B; Tue, 1 Jul 2025 06:57:09 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Oleg Nesterov , Kees Cook , Akihiko Odaki Subject: [PATCH 23/23] binfmt_elf: Warn on missing or suspicious regset note names Date: Tue, 1 Jul 2025 14:56:16 +0100 Message-Id: <20250701135616.29630-24-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250701135616.29630-1-Dave.Martin@arm.com> References: <20250701135616.29630-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that all regset definitions declare an explicit note name, warn if the note name is missing when generating a core dump. Simplify the fallback to always guess "LINUX", which is appropriate for all Linux-specific notes (i.e., all newly added notes, for a long time now). The one standard exception (PR_FPREG) will no longer have an "unexpected" note name overridden, but a warning will still be emitted. Also warn if the specified note name doesn't match the legacy pattern -- but don't bother to override the name in this case. This warning can be removed in future if new note types emerge that require a specific note name that is not "LINUX". No functional change, beyond the extra noise in dmesg and not overriding an unexpected note name for PR_FPREG any more. Now that all upstream arches are ported to use USER_REGSET_NOTE_TYPE(), new regsets created by copy-pasting existing code should end up correct by construction. Signed-off-by: Dave Martin Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Reviewed-by: Akihiko Odaki --- ***NOTE*** This patch is included here for completeness, but I expect to repost it in a future cycle, once the arch patches have gone in. Un-migrated arches will trigger WARNs with this patch applied, and arches that don't specify codedump note names will always get "LINUX" -- since the whole point is to stop guessing the note name in the core code. On _unpatched_ arches (only) this is a potential ABI break for the NT_PRFPREG note (which, for historical reasons, is a "CORE" note even though it is OS-specific on most or all arches). Cheers ---Dave --- fs/binfmt_elf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 89063d1d9e9a..92cf005468b5 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1750,8 +1750,13 @@ static int fill_thread_core_info(struct elf_thread_c= ore_info *t, if (is_fpreg) SET_PR_FPVALID(&t->prstatus); =20 - if (!note_name) - note_name =3D is_fpreg ? NN_PRFPREG : "LINUX"; + /* There should be a note name, but if not, guess: */ + if (WARN_ON_ONCE(!note_name)) + note_name =3D "LINUX"; + else + /* Warn on non-legacy-compatible names, for now. */ + WARN_ON_ONCE(strcmp(note_name, + is_fpreg ? "CORE" : "LINUX")); =20 __fill_note(&t->notes[note_iter], note_name, note_type, ret, data); --=20 2.34.1