public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Ard Biesheuvel <ardb+git@google.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, will@kernel.org,
	mark.rutland@arm.com, Ard Biesheuvel <ardb@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Liz Prucka <lizprucka@google.com>,
	Seth Jenkins <sethjenkins@google.com>,
	Kees Cook <kees@kernel.org>,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH v3 01/13] arm64: Move the zero page to rodata
Date: Wed, 8 Apr 2026 14:43:29 +0100	[thread overview]
Message-ID: <adZbgYJqY6bisaoZ@arm.com> (raw)
In-Reply-To: <20260320145934.2349881-16-ardb+git@google.com>

Hi Ard,

On Fri, Mar 20, 2026 at 03:59:36PM +0100, Ard Biesheuvel wrote:
> diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
> index 2964aad0362e..2d021a576e50 100644
> --- a/arch/arm64/kernel/vmlinux.lds.S
> +++ b/arch/arm64/kernel/vmlinux.lds.S
> @@ -229,6 +229,7 @@ SECTIONS
>  #endif
>  
>  	reserved_pg_dir = .;
> +	empty_zero_page = .;
>  	. += PAGE_SIZE;
>  
>  	swapper_pg_dir = .;
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index a6a00accf4f9..795743913ce5 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -66,9 +66,8 @@ long __section(".mmuoff.data.write") __early_cpu_boot_status;
>  
>  /*
>   * Empty_zero_page is a special page that is used for zero-initialized data
> - * and COW.
> + * and COW. Defined in the linker script.
>   */
> -unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] __page_aligned_bss;
>  EXPORT_SYMBOL(empty_zero_page);

I looked at Sashiko's reports
(https://sashiko.dev/#/patchset/20260320145934.2349881-15-ardb+git@google.com)
and it has a point here that with MTE, map_mem() doesn't map the
empty_zero_page as Tagged in the for_each_mem_range() loop. The
subsequent cpu_enable_mte() will fail to initialise the tags. I think
this problem disappears with patch 11 where all the linear map is now
Tagged.

We either ignore it or we temporarily map the kernel as Tagged until the
linear alias is removed later:

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 795743913ce5..5290f7537074 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -1175,7 +1175,7 @@ static void __init map_mem(pgd_t *pgdp)
 	 * so we should avoid them here.
 	 */
 	__map_memblock(pgdp, kernel_start, kernel_end,
-		       PAGE_KERNEL, NO_CONT_MAPPINGS);
+		       pgprot_tagged(PAGE_KERNEL), NO_CONT_MAPPINGS);
 	memblock_clear_nomap(kernel_start, kernel_end - kernel_start);
 	arm64_kfence_map_pool(early_kfence_pool, pgdp);
 }

-- 
Catalin


  reply	other threads:[~2026-04-08 13:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 14:59 [PATCH v3 00/13] arm64: Unmap linear alias of kernel data/bss Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 01/13] arm64: Move the zero page to rodata Ard Biesheuvel
2026-04-08 13:43   ` Catalin Marinas [this message]
2026-04-08 15:09     ` Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 02/13] arm64: mm: Preserve existing table mappings when mapping DRAM Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 03/13] arm64: mm: Preserve non-contiguous descriptors " Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 04/13] arm64: mm: Remove bogus stop condition from map_mem() loop Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 05/13] arm64: mm: Drop redundant pgd_t* argument from map_mem() Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 06/13] arm64: mm: Permit contiguous descriptors to be rewritten Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 07/13] arm64: mm: Use hierarchical XN mapping for the fixmap Ard Biesheuvel
2026-04-08 15:45   ` Catalin Marinas
2026-04-08 15:48     ` Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 08/13] arm64: kfence: Avoid NOMAP tricks when mapping the early pool Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 09/13] arm64: mm: Permit contiguous attribute for preliminary mappings Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 10/13] arm64: Move fixmap page tables to end of kernel image Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 11/13] arm64: mm: Don't abuse memblock NOMAP to check for overlaps Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 12/13] arm64: mm: Map the kernel data/bss read-only in the linear map Ard Biesheuvel
2026-03-20 14:59 ` [PATCH v3 13/13] arm64: mm: Unmap kernel data/bss entirely from " Ard Biesheuvel

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=adZbgYJqY6bisaoZ@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizprucka@google.com \
    --cc=mark.rutland@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=sethjenkins@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox