All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	Luis Machado <luis.machado@linaro.org>,
	John Baldwin <jhb@FreeBSD.org>, Arnd Bergmann <arnd@arndb.de>,
	Kees Cook <keescook@chromium.org>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 0/5] arm64: mte: add core dump support
Date: Wed, 08 Dec 2021 11:21:24 -0600	[thread overview]
Message-ID: <8735n3812j.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <20211208121941.494956-1-catalin.marinas@arm.com> (Catalin Marinas's message of "Wed, 8 Dec 2021 12:19:36 +0000")

Catalin Marinas <catalin.marinas@arm.com> writes:

> Hi,
>
> Add core dump support for MTE tags. When a core file is generated and
> the user has mappings with PROT_MTE, segments with the PT_ARM_MEMTAG_MTE
> type are dumped. These correspond to the PT_LOAD segments for the same
> virtual addresses.

Why did you choose to encode this information as a program header
instead of as a note?

I can't see anything fundamentally wrong with encoding this information
as a new program header type, but I also don't know what makes this
information special enough that it doesn't work as a note.

The advantage for encoding things as a note is that everyone pretty much
already knows what to do with notes, and notes they do not understand.

If this was something the loader would need when loading an application,
and the loader could parse this program header as well that would
definitely be justification for using a program header.

I also don't know what an MTE tag is.  A memory type extension?

Eric


> The last patch documents the core file format. The tags are dumped
> packed, two tags per byte (unlike ptrace where we have one tag per byte)
> and there is no header to define the format, it's all fixed for the
> PT_ARM_MEMTAG_MTE type.
>
> Below you can see the output of 'readelf -a core' for a program mapping
> two regions with PROT_MTE, one 2-page and the other 4-page long. Half of
> the first page in each range was filled with 0xa and 0xb tags
> respectively.
>
> Program Headers:
>   Type             Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
>   ...
>   LOAD             0x030000 0x0000ffff80034000 0x0000000000000000 0x000000 0x002000 RW  0x1000
>   LOAD             0x030000 0x0000ffff80036000 0x0000000000000000 0x004000 0x004000 RW  0x1000
>   ...
>   LOPROC+0x5441470 0x05b000 0x0000ffff80034000 0x0000000000000000 0x000100 0x002000     0
>   LOPROC+0x5441470 0x05b100 0x0000ffff80036000 0x0000000000000000 0x000200 0x004000     0
>
> The relevant 'od -tx1 core' output:
>
> 05b000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
> *
> 05b040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> *
> 05b100 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
> *
> 05b140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> *
> 05b300
>
> Catalin Marinas (5):
>   elfcore: Replace CONFIG_{IA64,UML} checks with a new option
>   elf: Introduce the ARM MTE ELF segment type
>   arm64: mte: Define the number of bytes for storing the tags in a page
>   arm64: mte: Dump the MTE tags in the core file
>   arm64: mte: Document the core dump file format
>
>  .../arm64/memory-tagging-extension.rst        |  22 ++++
>  arch/arm64/Kconfig                            |   1 +
>  arch/arm64/include/asm/mte-def.h              |   1 +
>  arch/arm64/kernel/Makefile                    |   1 +
>  arch/arm64/kernel/elfcore.c                   | 123 ++++++++++++++++++
>  arch/arm64/lib/mte.S                          |   4 +-
>  arch/arm64/mm/mteswap.c                       |   2 +-
>  arch/ia64/Kconfig                             |   1 +
>  arch/x86/um/Kconfig                           |   1 +
>  fs/Kconfig.binfmt                             |   3 +
>  include/linux/elfcore.h                       |   4 +-
>  include/uapi/linux/elf.h                      |   3 +
>  12 files changed, 161 insertions(+), 5 deletions(-)
>  create mode 100644 arch/arm64/kernel/elfcore.c

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-12-08 17:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 12:19 [PATCH 0/5] arm64: mte: add core dump support Catalin Marinas
2021-12-08 12:19 ` [PATCH 1/5] elfcore: Replace CONFIG_{IA64, UML} checks with a new option Catalin Marinas
2021-12-08 12:19 ` [PATCH 2/5] elf: Introduce the ARM MTE ELF segment type Catalin Marinas
2022-01-03 17:28   ` Luis Machado
2021-12-08 12:19 ` [PATCH 3/5] arm64: mte: Define the number of bytes for storing the tags in a page Catalin Marinas
2022-01-03 17:27   ` Luis Machado
2021-12-08 12:19 ` [PATCH 4/5] arm64: mte: Dump the MTE tags in the core file Catalin Marinas
2022-01-03 17:27   ` Luis Machado
2021-12-08 12:19 ` [PATCH 5/5] arm64: mte: Document the core dump file format Catalin Marinas
2022-01-03 17:27   ` Luis Machado
2022-01-04 12:33     ` Catalin Marinas
2021-12-08 17:21 ` Eric W. Biederman [this message]
2021-12-08 17:57   ` [PATCH 0/5] arm64: mte: add core dump support Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735n3812j.fsf@email.froward.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=jhb@FreeBSD.org \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=luis.machado@linaro.org \
    --cc=szabolcs.nagy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.