public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] AArch64: Add pauth core file section
@ 2019-02-15 14:01 Alan Hayward
  2019-02-19 15:34 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Hayward @ 2019-02-15 14:01 UTC (permalink / raw)
  To: binutils; +Cc: nd, Alan Hayward

Used for the AArch64 pointer authentication code mask registers in Arm v8.3-a.

NT_ARM_PAC_MASK matches the value in Linux include/uapi/linux/elf.h

include/ChangeLog:

2019-02-15  Alan Hayward  <alan.hayward@arm.com>

	* elf/common.h (NT_ARM_PAC_MASK): Add define.

bfd/ChangeLog:

2019-02-15  Alan Hayward  <alan.hayward@arm.com>

	* elf-bfd.h (elfcore_write_aarch_pauth): Add declaration.
	* elf.c (elfcore_grok_aarch_pauth): New function.
	(elfcore_grok_note): Check for NT_ARM_PAC_MASK.
	(elfcore_write_aarch_pauth): New function.
	(elfcore_write_register_note): Check for AArch64 pauth section.
---
 bfd/elf-bfd.h        |  2 ++
 bfd/elf.c            | 27 +++++++++++++++++++++++++++
 include/elf/common.h |  2 ++
 3 files changed, 31 insertions(+)

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 5741c60264..56cddda641 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2634,6 +2634,8 @@ extern char *elfcore_write_aarch_hw_watch
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_aarch_sve
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_aarch_pauth
+  (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_lwpstatus
   (bfd *, char *, int *, long, int, const void *);
 extern char *elfcore_write_register_note
diff --git a/bfd/elf.c b/bfd/elf.c
index eb3e1828e9..f16acaa08d 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9541,6 +9541,12 @@ elfcore_grok_aarch_sve (bfd *abfd, Elf_Internal_Note *note)
   return elfcore_make_note_pseudosection (abfd, ".reg-aarch-sve", note);
 }
 
+static bfd_boolean
+elfcore_grok_aarch_pauth (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-aarch-pauth", note);
+}
+
 #if defined (HAVE_PRPSINFO_T)
 typedef prpsinfo_t   elfcore_psinfo_t;
 #if defined (HAVE_PRPSINFO32_T)		/* Sparc64 cross Sparc32 */
@@ -10135,6 +10141,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
       else
 	return TRUE;
 
+    case NT_ARM_PAC_MASK:
+      if (note->namesz == 6
+	  && strcmp (note->namedata, "LINUX") == 0)
+	return elfcore_grok_aarch_pauth (abfd, note);
+      else
+	return TRUE;
+
     case NT_PRPSINFO:
     case NT_PSINFO:
       if (bed->elf_backend_grok_psinfo)
@@ -11494,6 +11507,18 @@ elfcore_write_aarch_sve (bfd *abfd,
 			     note_name, NT_ARM_SVE, aarch_sve, size);
 }
 
+char *
+elfcore_write_aarch_pauth (bfd *abfd,
+			   char *buf,
+			   int *bufsiz,
+			   const void *aarch_pauth,
+			   int size)
+{
+  char *note_name = "LINUX";
+  return elfcore_write_note (abfd, buf, bufsiz,
+			     note_name, NT_ARM_PAC_MASK, aarch_pauth, size);
+}
+
 char *
 elfcore_write_register_note (bfd *abfd,
 			     char *buf,
@@ -11574,6 +11599,8 @@ elfcore_write_register_note (bfd *abfd,
     return elfcore_write_aarch_hw_watch (abfd, buf, bufsiz, data, size);
   if (strcmp (section, ".reg-aarch-sve") == 0)
     return elfcore_write_aarch_sve (abfd, buf, bufsiz, data, size);
+  if (strcmp (section, ".reg-aarch-pauth") == 0)
+    return elfcore_write_aarch_pauth (abfd, buf, bufsiz, data, size);
   return NULL;
 }
 
diff --git a/include/elf/common.h b/include/elf/common.h
index 996acf9703..e8faf67be3 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -650,6 +650,8 @@
 					/*   note name must be "LINUX".  */
 #define NT_ARM_SVE	0x405		/* AArch SVE registers.  */
 					/*   note name must be "LINUX".  */
+#define NT_ARM_PAC_MASK	0x406		/* AArch pointer authentication code masks */
+					/*   note name must be "LINUX".  */
 #define NT_SIGINFO	0x53494749	/* Fields of siginfo_t.  */
 #define NT_FILE		0x46494c45	/* Description of mapped files.  */
 
-- 
2.17.2 (Apple Git-113)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] AArch64: Add pauth core file section
  2019-02-15 14:01 [PATCH] AArch64: Add pauth core file section Alan Hayward
@ 2019-02-19 15:34 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2019-02-19 15:34 UTC (permalink / raw)
  To: Alan Hayward, binutils; +Cc: nd

Hi Alan,

> include/ChangeLog:
> 2019-02-15  Alan Hayward  <alan.hayward@arm.com>
> 
> 	* elf/common.h (NT_ARM_PAC_MASK): Add define.
> 
> bfd/ChangeLog:
> 2019-02-15  Alan Hayward  <alan.hayward@arm.com>
> 
> 	* elf-bfd.h (elfcore_write_aarch_pauth): Add declaration.
> 	* elf.c (elfcore_grok_aarch_pauth): New function.
> 	(elfcore_grok_note): Check for NT_ARM_PAC_MASK.
> 	(elfcore_write_aarch_pauth): New function.
> 	(elfcore_write_register_note): Check for AArch64 pauth section.

Approved - please apply.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-19 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-15 14:01 [PATCH] AArch64: Add pauth core file section Alan Hayward
2019-02-19 15:34 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).