Skip to content

Commit e6c3b5b

Browse files
committed
AArch64: Add pauth core file section
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: * elf/common.h (NT_ARM_PAC_MASK): Add define. bfd/ChangeLog: * 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.
1 parent 34d75fb commit e6c3b5b

5 files changed

Lines changed: 43 additions & 0 deletions

File tree

‎bfd/ChangeLog‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2019-02-20 Alan Hayward <alan.hayward@arm.com>
2+
3+
* elf-bfd.h (elfcore_write_aarch_pauth): Add declaration.
4+
* elf.c (elfcore_grok_aarch_pauth): New function.
5+
(elfcore_grok_note): Check for NT_ARM_PAC_MASK.
6+
(elfcore_write_aarch_pauth): New function.
7+
(elfcore_write_register_note): Check for AArch64 pauth section.
8+
19
2019-02-20 Alan Modra <amodra@gmail.com>
210

311
PR 24225

‎bfd/elf-bfd.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,6 +2634,8 @@ extern char *elfcore_write_aarch_hw_watch
26342634
(bfd *, char *, int *, const void *, int);
26352635
extern char *elfcore_write_aarch_sve
26362636
(bfd *, char *, int *, const void *, int);
2637+
extern char *elfcore_write_aarch_pauth
2638+
(bfd *, char *, int *, const void *, int);
26372639
extern char *elfcore_write_lwpstatus
26382640
(bfd *, char *, int *, long, int, const void *);
26392641
extern char *elfcore_write_register_note

‎bfd/elf.c‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9541,6 +9541,12 @@ elfcore_grok_aarch_sve (bfd *abfd, Elf_Internal_Note *note)
95419541
return elfcore_make_note_pseudosection (abfd, ".reg-aarch-sve", note);
95429542
}
95439543

9544+
static bfd_boolean
9545+
elfcore_grok_aarch_pauth (bfd *abfd, Elf_Internal_Note *note)
9546+
{
9547+
return elfcore_make_note_pseudosection (abfd, ".reg-aarch-pauth", note);
9548+
}
9549+
95449550
#if defined (HAVE_PRPSINFO_T)
95459551
typedef prpsinfo_t elfcore_psinfo_t;
95469552
#if defined (HAVE_PRPSINFO32_T) /* Sparc64 cross Sparc32 */
@@ -10135,6 +10141,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
1013510141
else
1013610142
return TRUE;
1013710143

10144+
case NT_ARM_PAC_MASK:
10145+
if (note->namesz == 6
10146+
&& strcmp (note->namedata, "LINUX") == 0)
10147+
return elfcore_grok_aarch_pauth (abfd, note);
10148+
else
10149+
return TRUE;
10150+
1013810151
case NT_PRPSINFO:
1013910152
case NT_PSINFO:
1014010153
if (bed->elf_backend_grok_psinfo)
@@ -11494,6 +11507,18 @@ elfcore_write_aarch_sve (bfd *abfd,
1149411507
note_name, NT_ARM_SVE, aarch_sve, size);
1149511508
}
1149611509

11510+
char *
11511+
elfcore_write_aarch_pauth (bfd *abfd,
11512+
char *buf,
11513+
int *bufsiz,
11514+
const void *aarch_pauth,
11515+
int size)
11516+
{
11517+
char *note_name = "LINUX";
11518+
return elfcore_write_note (abfd, buf, bufsiz,
11519+
note_name, NT_ARM_PAC_MASK, aarch_pauth, size);
11520+
}
11521+
1149711522
char *
1149811523
elfcore_write_register_note (bfd *abfd,
1149911524
char *buf,
@@ -11574,6 +11599,8 @@ elfcore_write_register_note (bfd *abfd,
1157411599
return elfcore_write_aarch_hw_watch (abfd, buf, bufsiz, data, size);
1157511600
if (strcmp (section, ".reg-aarch-sve") == 0)
1157611601
return elfcore_write_aarch_sve (abfd, buf, bufsiz, data, size);
11602+
if (strcmp (section, ".reg-aarch-pauth") == 0)
11603+
return elfcore_write_aarch_pauth (abfd, buf, bufsiz, data, size);
1157711604
return NULL;
1157811605
}
1157911606

‎include/ChangeLog‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2019-02-20 Alan Hayward <alan.hayward@arm.com>
2+
3+
* elf/common.h (NT_ARM_PAC_MASK): Add define.
4+
15
2019-02-15 Saagar Jha <saagar@saagarjha.com>
26

37
* mach-o/loader.h: Use new OS names in comments.

‎include/elf/common.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@
650650
/* note name must be "LINUX". */
651651
#define NT_ARM_SVE 0x405 /* AArch SVE registers. */
652652
/* note name must be "LINUX". */
653+
#define NT_ARM_PAC_MASK 0x406 /* AArch pointer authentication code masks */
654+
/* note name must be "LINUX". */
653655
#define NT_SIGINFO 0x53494749 /* Fields of siginfo_t. */
654656
#define NT_FILE 0x46494c45 /* Description of mapped files. */
655657

0 commit comments

Comments
 (0)