[1/3] aarch64: Add NT_ARM_TAGGED_ADDR_CTRL regset

Message ID 20240814085134.109500-2-kuan-ying.lee@canonical.com
State Committed
Headers
Series aarch64: add some core note types name |

Commit Message

Kuan-Ying Lee Aug. 14, 2024, 8:51 a.m. UTC
  Add the NT_ARM_TAGGED_ADDR_CTRL regset for aarch64.
Recognize and print this new core itme.

Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com>
---
 backends/aarch64_corenote.c  | 11 ++++++++++-
 libebl/eblcorenotetypename.c |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)
  

Comments

Mark Wielaard Aug. 16, 2024, 11:16 p.m. UTC | #1
On Wed, Aug 14, 2024 at 04:51:18PM +0800, Kuan-Ying Lee wrote:
> Add the NT_ARM_TAGGED_ADDR_CTRL regset for aarch64.
> Recognize and print this new core itme.

Thanks, found the description (The corresponding regset is 1 element
of 8 bytes) here
https://docs.kernel.org/arch/arm64/memory-tagging-extension.html

Implementation looks correct.

Pushed,

Mark

> 
> Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com>
> ---
>  backends/aarch64_corenote.c  | 11 ++++++++++-
>  libebl/eblcorenotetypename.c |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/backends/aarch64_corenote.c b/backends/aarch64_corenote.c
> index 905a4b8ab9f5..bd0a4a725411 100644
> --- a/backends/aarch64_corenote.c
> +++ b/backends/aarch64_corenote.c
> @@ -107,6 +107,14 @@ static const Ebl_Core_Item aarch64_syscall_items [] =
>      }
>    };
>  
> +static const Ebl_Core_Item aarch64_mte_items [] =
> +  {
> +    {
> +      .name = "tag_ctrl", .type = ELF_T_XWORD, .format = 'x',
> +      .offset = 0, .group = "register"
> +    }
> +  };
> +
>  #define AARCH64_HWBP_REG(KIND, N)					\
>      {									\
>        .name = "DBG" KIND "VR" #N "_EL1", .type = ELF_T_XWORD, .format = 'x', \
> @@ -167,6 +175,7 @@ AARCH64_BP_WP_GROUP ("W", aarch64_hw_wp_items);
>    EXTRA_ITEMS (NT_ARM_TLS, 8, aarch64_tls_items)			\
>    EXTRA_ITEMS (NT_ARM_HW_BREAK, 264, aarch64_hw_bp_items)		\
>    EXTRA_ITEMS (NT_ARM_HW_WATCH, 264, aarch64_hw_wp_items)		\
> -  EXTRA_ITEMS (NT_ARM_SYSTEM_CALL, 4, aarch64_syscall_items)
> +  EXTRA_ITEMS (NT_ARM_SYSTEM_CALL, 4, aarch64_syscall_items) \
> +  EXTRA_ITEMS (NT_ARM_TAGGED_ADDR_CTRL, 8, aarch64_mte_items)
>  
>  #include "linux-core-note.c"
> diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c
> index 0e790d062de5..49331bdf76e8 100644
> --- a/libebl/eblcorenotetypename.c
> +++ b/libebl/eblcorenotetypename.c
> @@ -92,6 +92,7 @@ ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf, size_t len)
>  	    KNOWNSTYPE (ARM_HW_BREAK);
>  	    KNOWNSTYPE (ARM_HW_WATCH);
>  	    KNOWNSTYPE (ARM_SYSTEM_CALL);
> +	    KNOWNSTYPE (ARM_TAGGED_ADDR_CTRL);
>  	    KNOWNSTYPE (SIGINFO);
>  	    KNOWNSTYPE (FILE);
>  #undef KNOWNSTYPE
> -- 
> 2.43.0
>
  

Patch

diff --git a/backends/aarch64_corenote.c b/backends/aarch64_corenote.c
index 905a4b8ab9f5..bd0a4a725411 100644
--- a/backends/aarch64_corenote.c
+++ b/backends/aarch64_corenote.c
@@ -107,6 +107,14 @@  static const Ebl_Core_Item aarch64_syscall_items [] =
     }
   };
 
+static const Ebl_Core_Item aarch64_mte_items [] =
+  {
+    {
+      .name = "tag_ctrl", .type = ELF_T_XWORD, .format = 'x',
+      .offset = 0, .group = "register"
+    }
+  };
+
 #define AARCH64_HWBP_REG(KIND, N)					\
     {									\
       .name = "DBG" KIND "VR" #N "_EL1", .type = ELF_T_XWORD, .format = 'x', \
@@ -167,6 +175,7 @@  AARCH64_BP_WP_GROUP ("W", aarch64_hw_wp_items);
   EXTRA_ITEMS (NT_ARM_TLS, 8, aarch64_tls_items)			\
   EXTRA_ITEMS (NT_ARM_HW_BREAK, 264, aarch64_hw_bp_items)		\
   EXTRA_ITEMS (NT_ARM_HW_WATCH, 264, aarch64_hw_wp_items)		\
-  EXTRA_ITEMS (NT_ARM_SYSTEM_CALL, 4, aarch64_syscall_items)
+  EXTRA_ITEMS (NT_ARM_SYSTEM_CALL, 4, aarch64_syscall_items) \
+  EXTRA_ITEMS (NT_ARM_TAGGED_ADDR_CTRL, 8, aarch64_mte_items)
 
 #include "linux-core-note.c"
diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c
index 0e790d062de5..49331bdf76e8 100644
--- a/libebl/eblcorenotetypename.c
+++ b/libebl/eblcorenotetypename.c
@@ -92,6 +92,7 @@  ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf, size_t len)
 	    KNOWNSTYPE (ARM_HW_BREAK);
 	    KNOWNSTYPE (ARM_HW_WATCH);
 	    KNOWNSTYPE (ARM_SYSTEM_CALL);
+	    KNOWNSTYPE (ARM_TAGGED_ADDR_CTRL);
 	    KNOWNSTYPE (SIGINFO);
 	    KNOWNSTYPE (FILE);
 #undef KNOWNSTYPE