diff mbox series

[5/5] arm64: mte: Document the core dump file format

Message ID 20211208121941.494956-6-catalin.marinas@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64: mte: add core dump support | expand

Commit Message

Catalin Marinas Dec. 8, 2021, 12:19 p.m. UTC
Add the program header definition and data layout for the
PT_ARM_MEMTAG_MTE segments.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 .../arm64/memory-tagging-extension.rst        | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Luis Machado Jan. 3, 2022, 5:27 p.m. UTC | #1
On 12/8/21 9:19 AM, Catalin Marinas wrote:
> Add the program header definition and data layout for the
> PT_ARM_MEMTAG_MTE segments.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
>   .../arm64/memory-tagging-extension.rst        | 22 +++++++++++++++++++
>   1 file changed, 22 insertions(+)
> 
> diff --git a/Documentation/arm64/memory-tagging-extension.rst b/Documentation/arm64/memory-tagging-extension.rst
> index 7b99c8f428eb..34c7eb47f61e 100644
> --- a/Documentation/arm64/memory-tagging-extension.rst
> +++ b/Documentation/arm64/memory-tagging-extension.rst
> @@ -213,6 +213,28 @@ address ABI control and MTE configuration of a process as per the
>   Documentation/arm64/tagged-address-abi.rst and above. The corresponding
>   ``regset`` is 1 element of 8 bytes (``sizeof(long))``).
>   
> +Core dump support
> +-----------------
> +
> +The allocation tags for user memory mapped with ``PROT_MTE`` are dumped
> +in the core file as additional ``PT_ARM_MEMTAG_MTE`` segments. The
> +program header for such segment is defined as:
> +
> +:``p_type``: ``PT_ARM_MEMTAG_MTE``
> +:``p_flags``: 0
> +:``p_offset``: segment file offset
> +:``p_vaddr``: segment virtual address, same as the corresponding
> +  ``PT_LOAD`` segment
> +:``p_paddr``: 0
> +:``p_filesz``: segment size in file, calculated as ``p_mem_sz / 16 / 2``

For the sake of making things extra clear, I'd describe what the 
constants (16 and 2) mean.

> +:``p_memsz``: segment size in memory, same as the corresponding
> +  ``PT_LOAD`` segment
> +:``p_align``: 0
> +
> +The tags are stored in the core file at ``p_offset`` as two 4-bit tags
> +in a byte. With the tag granule of 16 bytes, a 4K page requires 128
> +bytes in the core file.
> +
>   Example of correct usage
>   ========================
>   
> 

Otherwise looks good to me.

Acked-by: Luis Machado <luis.machado@linaro.org>
Catalin Marinas Jan. 4, 2022, 12:33 p.m. UTC | #2
Hi Luis,

On Mon, Jan 03, 2022 at 02:27:54PM -0300, Luis Machado wrote:
> On 12/8/21 9:19 AM, Catalin Marinas wrote:
> > diff --git a/Documentation/arm64/memory-tagging-extension.rst b/Documentation/arm64/memory-tagging-extension.rst
> > index 7b99c8f428eb..34c7eb47f61e 100644
> > --- a/Documentation/arm64/memory-tagging-extension.rst
> > +++ b/Documentation/arm64/memory-tagging-extension.rst
> > @@ -213,6 +213,28 @@ address ABI control and MTE configuration of a process as per the
> >   Documentation/arm64/tagged-address-abi.rst and above. The corresponding
> >   ``regset`` is 1 element of 8 bytes (``sizeof(long))``).
> > +Core dump support
> > +-----------------
> > +
> > +The allocation tags for user memory mapped with ``PROT_MTE`` are dumped
> > +in the core file as additional ``PT_ARM_MEMTAG_MTE`` segments. The
> > +program header for such segment is defined as:
> > +
> > +:``p_type``: ``PT_ARM_MEMTAG_MTE``
> > +:``p_flags``: 0
> > +:``p_offset``: segment file offset
> > +:``p_vaddr``: segment virtual address, same as the corresponding
> > +  ``PT_LOAD`` segment
> > +:``p_paddr``: 0
> > +:``p_filesz``: segment size in file, calculated as ``p_mem_sz / 16 / 2``
> 
> For the sake of making things extra clear, I'd describe what the constants
> (16 and 2) mean.

I'll rewrite this as: "``p_mem_sz / 32`` (two 4-bit tags cover 32 bytes
of memory)". I find the "16 / 2" more confusing.

> Acked-by: Luis Machado <luis.machado@linaro.org>

Thanks for the acks.
diff mbox series

Patch

diff --git a/Documentation/arm64/memory-tagging-extension.rst b/Documentation/arm64/memory-tagging-extension.rst
index 7b99c8f428eb..34c7eb47f61e 100644
--- a/Documentation/arm64/memory-tagging-extension.rst
+++ b/Documentation/arm64/memory-tagging-extension.rst
@@ -213,6 +213,28 @@  address ABI control and MTE configuration of a process as per the
 Documentation/arm64/tagged-address-abi.rst and above. The corresponding
 ``regset`` is 1 element of 8 bytes (``sizeof(long))``).
 
+Core dump support
+-----------------
+
+The allocation tags for user memory mapped with ``PROT_MTE`` are dumped
+in the core file as additional ``PT_ARM_MEMTAG_MTE`` segments. The
+program header for such segment is defined as:
+
+:``p_type``: ``PT_ARM_MEMTAG_MTE``
+:``p_flags``: 0
+:``p_offset``: segment file offset
+:``p_vaddr``: segment virtual address, same as the corresponding
+  ``PT_LOAD`` segment
+:``p_paddr``: 0
+:``p_filesz``: segment size in file, calculated as ``p_mem_sz / 16 / 2``
+:``p_memsz``: segment size in memory, same as the corresponding
+  ``PT_LOAD`` segment
+:``p_align``: 0
+
+The tags are stored in the core file at ``p_offset`` as two 4-bit tags
+in a byte. With the tag granule of 16 bytes, a 4K page requires 128
+bytes in the core file.
+
 Example of correct usage
 ========================