From patchwork Wed Dec 8 12:19:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 12695332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4375C433F5 for ; Wed, 8 Dec 2021 12:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6qFB02Pjca9ybBoLWFbYQVVyd7ec1Ot7eFgKGtajhbw=; b=Sh5dMbPwA7Mpnv kk2j4dZ6+VB+R2lUiVn64VHVcBsY0emUiVB2uinQHzt5zdo4crr0X4jkSGyf1bqW1xQiC/QlsCUpc Xw+X/rJcF/2XlKAfkridnVhZo6MB66aqJQVAbKGnToAZOb13Nc626YQzqtoibHWibupI1rfxoeDWR yg0ayss4DtCzeq1C/Em6yx/WrZilz2tbIwx53oYeZmaJdpSh039H76Jy2eLNGXO+VtlIE4C6hVY1f zWZghjVCEEiGVKjduClYdG9j+4MLTH5LQ3jCLB03gIijsdP59qPiuZG56rhMJE1eR1c+bqK7oyxQ+ GH1JO49/GHdl3H2JhzhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muvwP-00CSE8-Cc; Wed, 08 Dec 2021 12:20:57 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muvvU-00CRt7-L5 for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 12:20:02 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 668C1B81F7C; Wed, 8 Dec 2021 12:19:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42395C341C7; Wed, 8 Dec 2021 12:19:56 +0000 (UTC) From: Catalin Marinas To: linux-arm-kernel@lists.infradead.org Cc: Will Deacon , Luis Machado , John Baldwin , Arnd Bergmann , "Eric W. Biederman" , Kees Cook , Szabolcs Nagy , Andrew Morton Subject: [PATCH 5/5] arm64: mte: Document the core dump file format Date: Wed, 8 Dec 2021 12:19:41 +0000 Message-Id: <20211208121941.494956-6-catalin.marinas@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211208121941.494956-1-catalin.marinas@arm.com> References: <20211208121941.494956-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_042000_862676_501C173C X-CRM114-Status: GOOD ( 11.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the program header definition and data layout for the PT_ARM_MEMTAG_MTE segments. Signed-off-by: Catalin Marinas Acked-by: Luis Machado --- .../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`` +:``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 ========================