From: Luis Machado Date: Fri, 11 Aug 2023 08:45:44 +0000 (+0100) Subject: [Morello] Teach gdb about additional CHERI auxv entries X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=690199d5d4180f287074f2976a12d2df1e415d67;p=thirdparty%2Fbinutils-gdb.git [Morello] Teach gdb about additional CHERI auxv entries CHERI/Morello defines some new auxv entries. Make sure gdb understands their type, even though gdb doesn't know how to display the capabilities themselves. --- diff --git a/gdb/auxv.c b/gdb/auxv.c index 87fc01db25c..ed290075151 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -540,6 +540,28 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, AUXV_FORMAT_HEX); TAG (AT_SUN_CAP_HW2, _("Machine-dependent CPU capability hints 2"), AUXV_FORMAT_HEX); + + /* CHERI-specific auxv entries. */ + TAG (AT_CHERI_EXEC_RW_CAP, + _("The executable's RW region capability, if it exists"), + AUXV_FORMAT_HEX); + TAG (AT_CHERI_EXEC_RX_CAP, _("The executable's RX capability"), + AUXV_FORMAT_HEX); + TAG (AT_CHERI_INTERP_RW_CAP, + _("The interpreter's RW region capability, if it exists"), + AUXV_FORMAT_HEX); + TAG (AT_CHERI_INTERP_RX_CAP, _("The interpreter's RX region capability"), + AUXV_FORMAT_HEX); + TAG (AT_CHERI_STACK_CAP, _("The stack capability"), AUXV_FORMAT_HEX); + TAG (AT_CHERI_SEAL_CAP, _("The root sealing capability"), + AUXV_FORMAT_HEX); + TAG (AT_CHERI_CID_CAP, _("The root CID capability"), AUXV_FORMAT_HEX); + TAG (AT_ARGC, _("The number of initial arguments"), AUXV_FORMAT_DEC); + TAG (AT_ARGV, _("Capability to the initial arguments"), AUXV_FORMAT_HEX); + TAG (AT_ENVC, _("The number of initial environment variable entries"), + AUXV_FORMAT_DEC); + TAG (AT_ENVP, _("Capability to the initial environment variables"), + AUXV_FORMAT_HEX); } fprint_auxv_entry (file, name, description, format, type, val); diff --git a/include/elf/common.h b/include/elf/common.h index c6a31cc1f5e..edd864ea140 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -1325,4 +1325,17 @@ #define AT_SUN_BRAND_AUX3 2022 #define AT_SUN_CAP_HW2 2023 /* Extension of AT_SUN_CAP_HW1. */ +/* CHERI auxv types. */ +#define AT_CHERI_EXEC_RW_CAP 60 +#define AT_CHERI_EXEC_RX_CAP 61 +#define AT_CHERI_INTERP_RW_CAP 62 +#define AT_CHERI_INTERP_RX_CAP 63 +#define AT_CHERI_STACK_CAP 64 +#define AT_CHERI_SEAL_CAP 65 +#define AT_CHERI_CID_CAP 66 +#define AT_ARGC 80 +#define AT_ARGV 81 +#define AT_ENVC 82 +#define AT_ENVP 83 + #endif /* _ELF_COMMON_H */